From Wikipedia (from an article on Baal, the ancient aka circa 5th century BC, pagan God of Phoenicia and Tyre):
Another version of the demon Baal is Beelzebub, or more accurately Ba‘al Zebûb or Ba‘al Zəbûb (Hebrew בעל-זבוב), who was originally the name of a deity worshipped in the Philistine city of Ekron. Ba‘al Zebûb might mean "Lord of Zebûb", referring to an unknown place named Zebûb. Some scholars have suggested that Ba'al Zebul which means 'lord prince' was deliberately changed by the worshippers of Yahweh to Ba'al Zebub ('lord of the flies', zebûb being a Hebrew collective noun meaning "fly") in order to ridicule and protest the worship of Ba'al Zebul.
In Christian demonology, Ba‘al Zebûb (anglicized Beelzebub) came to be identified as a demon or devil.