There have always been, and always will be, worms. Most are harmless, or even, like earthworms, beneficial. The land around the City of Bells was no exception to this rule. But at some point during the City's rise, the wild magic flowing around, or perhaps some mage experimenting, caused a rather unusual strain to appear, though admittedly, the Corpse Worm shares far more traits with grubs than true worms, and probably started as a group of maggots.
Their origin, however, is primarily irrelevant save to historians and the idly curious. Whatever caused them to come into being, the effects are the same; every so often, someone or something freshly dead will be found by a small group, which burrows into their flesh through the nose and mouth, taking great care to leave the skin intact, secreting preservatives as they go, eventually replacing every muscle the creature or person had with a group of themselves, at which time they, if necessary, begin to claw their way free of where they were buried, or if not, simply begin to go about their business, namely, finding more bodies to infect.
They have no real culture, though they do gain a basic moral and social structure, as well as speech skills, if they inhabit a person, at least once they have replicated sufficiently (as they have a form of hive mind, the more of them there are in a small area, the more intelligent they are, somewhat tempered by how intelligent the host began as; a group the size of a human or elf will probably be as smart as the host body was) to be able to recognize and use such concepts.
However, they do often try to get jobs involving the dead in one way or another, as that allows them to infect more people, normally one of their primary concerns, though this is hardly universal, at least among those inhabiting the skins of intelligent organisms, since in those cases they are essentially a thinking individual, and thus it is no more imperative for them to infect other bodies than it is for any other sapient lifeform to reproduce.