Most scholars of the Hebrew Bible read the name Beelzebub as a deliberate distortion. Second Kings names a Philistine god of Ekron, Baal-zebub, consulted by an Israelite king, and the title likely began as something closer to Baal Zebul, meaning roughly Lord of the [heavenly] Dwelling or Exalted Lord, a perfectly respectable honorific for a Canaanite storm and fertility deity related to the wider Baal cult. The form that survives, Baal-zebub, replaces zebul with zevuv, the Hebrew word for fly, turning Exalted Lord into something closer to Lord of the Flies, a change generally read as deliberate scribal mockery rather than an honest phonetic rendering, a common technique by which Israelite writers denigrated the gods of neighbouring peoples by altering their names into insults.
By the time the name reaches the New Testament, where religious opponents accuse Jesus of casting out demons by the power of Beelzebul or Beelzebub, prince of demons, the figure has moved a considerable distance from a specific Philistine deity's title into a generic byword for Satan himself or for a chief demon under him, used interchangeably with other names for the same adversarial role. The whole trajectory, from an exalted title, to a mocking distortion, to a generic name for evil, illustrates how a specific historical polemic against a rival religion's god can outlive the memory of that god entirely.