Hospedar and alojar both refer to being a host in the sense of receiving guests/visitors and/or giving them lodging/accomodation. Neither of them refer to being a host in the much broader sense that host has in English, but hospedar is much closer, since alojar just means "to provide a place" (also dar/proveer/brindar alojamiento).
In any case hospedar and anfitrión are not as directly related (semantically) as host (the verb) and host (the noun) are in English. You might refer to Russia as the anfitrión (anfitriona?) of the 2018 FIFA World Cup, but you wouldn't say «Rusia hospedará la Copa Mundial de la FIFA». In such cases you're better off just using the noun.
In other contexts hospedar is perfectly OK, but it's most natural to use it when there's a personal relationship between the host and the guests: it sounds a bit weird to say
El hotel me hospedó durante dos semanas.
but you would naturally say
Mis amigos me hospedaron durante dos semanas.
(For the former, you would say rather «Me hospedé en el hotel durante dos semanas», with hospedar in the pronominal or pseudo-reflexive form. The latter would work as well as «Me hospedé en lo de unos amigos durante dos semanas».)
You would likewise say:
Mis amigos fueron muy buenos anfitriones.
but not
El hotel fue un muy buen anfitrión.
Etymologically host and hospedar are cognates; host comes to English via French (it has the same root as hospital[ity]), and the corresponding Proto-Indoeuropean root (*ghos-ti) is the source of English guest.