Depending on the type, this has a couple answers.
Sentient undead are as follows. Many years before the modern day, two individuals had choice encounters with a voice who sold them on the idea of never dying. Little did these two know that they would become test subjects to the god of Corruption.
Vlox transformed an ailing young man named Bogdan using his puzzle cube, a device that is named after Vlox but has been around for much longer. One of the puzzle combinations allowed Bogdan to become combined with death, a being both alive but dead. This creation of Vlox no longer needed food but to keep its strength up, Bogdan had to feed off the essence that flowed through living beings blood. Throughout time, Bogdan was titled Grimbind for his alignment to the afterlife and he was deemed the first vampire.
The other being is more akin to a walking corpse, Crios Winterblood is the first wight, a cold dead body who retains the memories and wants of who they were before they die. Crios was a conqueror and made a deal with Vlox to never end his conquest. When Crios finally died in battle, he rose again as a corpse that could now spew blue flames that both freeze and burn his victims.
For less sentient and more wild undead, Spirits adn skeletons have no attachment to any direct meddling from a god or mortal.
Spirits are known throughout history as both pests and as revered beings. Spirits are leftover echoes of essence and wain with the randomness of the flow of essence running deep underneath the surface.