Old English gæst, giest (Anglian gest) "guest; enemy; stranger," the common notion being "stranger," from Proto-Germanic *gastiz (cf. Old Frisian jest, Dutch gast, German Gast, Gothic gasts "guest," originally "stranger"), from PIE root *ghosti- "strange" (cf. Latin hostis "enemy," hospes "host" -- from *hosti-potis "host, guest," originally "lord of strangers" -- Greek xenos "guest, host, stranger;" Old Church Slavonic gosti "guest, friend," gospodi "lord, master").
Spelling evolution influenced by Old Norse cognate gestr (the usual sound changes from the Old English word would have yielded Modern English *yest). Phrase be my guest in the sense of "go right ahead" first recorded 1955.