So while being a Lich is the classic way to live forever: magically binding your soul to a corpse while keeping a piece of it soul in a seperate object for protection. The other way doesn't keep the soul attached to a corpse or jewel; it binds it to a million squirming maggots.
Becoming a Worm That Walks is a much more obscure spell and ritual that sometimes requires the assistance of another similarly high-leveled wizard. The grave site must be tended for over a year before the death of the person to be transformed by watering it with blood and sowing it with meat. This focuses the magic and guarantees a healthy population of vermin. The dead spellcaster is placed in the grave, and his companion finishes the ritual by casting a spell that attracts all sorts of beetles and worms to feed on the body. After a week, the flesh, organs and bones of the deceased are consumed by the vermin, and they become a hivemind controlled by the spellcaster's soul. Assuming the ritual is performed correctly, there's still only a small chance that it will work. The spell requires a massive amount of magical energy to be in the recently deceased, which means that it's primarily epic level spellcasters that successfully become Worm That Walks.
So why become something as icky as a Worm That Walks rather than the comparatively less icky Lich? Potential increase in survivability. Yes, a Lich with a well-hidden phylactery will survive dying, but a savvy adventurer will destroy the phylactery before doing to fight the Lich (see the Harry Potter franchise). A Worm That Walks contains its lifeforce in its squirming mass. If it feels threatened, it will take the risky but potentially rewarding course of breaking its body apart, sending its bugs squirming everywhere. Since its body is made up of so many of these little critters, there's a good chance that at least one will survive and reproduce to create enough worms to form a new body.
Also, its attacks are pretty horrifying, especially the one where you get wrapped up and eaten alive by its body (100 points of damage per round). It's smart enough to disguise itself too, either preparing several extended disguise self spells or purchasing a hat of disguise.
Good against players with Scoleciphobia.