The story
Probably inherited from Northern Middle English *berghgast, *barghgast, from bergh, bargh (“barrow”) + gast (“ghost”). Alternative hypotheses that first element is burgh (“town”) or bere (“bear”) lack semantic motivation.
Etymology from Wiktionary, CC BY-SA 4.0.