The Dragon Durnehviir was, like all dragons in the very early days of the material world, an ally and servant of the mighty Alduin. He helped keep Humans and other races subjugated under the rule of dragonkind until their successful revolt against Alduin.
Durnehviir, like Alduin, enjoyed amassing and wielding power, and he took the path of the Necromancer. As he gathered arcane knowledge and power, he was noticed by the Ideal Masters, who deceived him by offering him their teachings and greater power. Eventually, they forever enslaved him (as they do all their victims) and made him the great guardian of the Soul Cairn. He is sworn to attack enemies of the Ideal Masters who appear there, should they manage to escape the wrath of the undead guardians of the Cairn, the draugr-like skeletal warriors known as the Bonemen and the Boneyard Keepers.
Although he regrets the choices that entrapped him there, Durnehviir is unable to completely free himself of his mystical connections to the Soul Cairn and, if summoned again to the world of Tamriel, can only stay there for a short period of time.