Yudhishthira was born to Kunti and the dharma God or Yama with the boon of sage Durvasa. He was the eldest born of Pandavas if we do not consider Karna. He was born on a full moon night and Pandu had suggested Kunti that invoke the God of justice so that the child would be righteous, kind, just, and noble like an ideal king.
Yudhishthira learnt martial arts from Kripacharya and Dronacharya. He was a skilled spear thrower and charioteer. His spear-throwing skills were so good that he could easily penetrate a wall as if it was paper. He was also taught by various sages such as Vyasa, Parashurama, Bhrigu, etc. Unlike his brothers, he never was into mischief and did not cause any harm to the Kauravas. He was kind and did not bear hatred towards anyone. In fact, he is also called Ajatashatru, meaning the one without enemies.
Pandavas went into hiding after they almost fell into the trap of the wax palace. After coming out of hiding, they were given to rule half of Hastinapur in the region of Khandavprastha. Khandavaprastha was a forest that was transformed into a prosperous kingdom by Yudhishthira, Krishna, and Mayasura.
He had a wife in Draupadi due to the misunderstanding caused by Kunti. He had also married Devika in her Swayamvar and Pauravi. He was noble and kind but had one vice that was known to everyone – his addiction to dice gambling. This vice was taken into consideration by Shakuni and exploited by him and the Kauravas. Yudhishthira put at stake his kingdom, his wife, his brothers, and everything he owned including himself for the game of dice. He lost the game due to the special dices created by Shakuni. Thus, Draupadi had to face humiliation in the court and the Pandavas had to go into 12 years of exile with the 13th one being in disguise.
One of the best-known stories about Yudhishthira is his encounter with a Yaksha who asked him a series of questions that he answered correctly. The other Pandavas went to Yaksha and ignored his plea of answering the questions and as a result, the water they drank from that lake choked them. Yudhishthira was able to save them by the answers he gave and impressed the Yaksha who was Yama, his own father.
After returning to Hastinapur from exile, he demanded his rights and kingdoms which were refused. This led to the war and he tried to avoid it with many truce proposals. He had to fight the war and eventually he won it. After ruling the kingdom for 36 years, he eventually went on the journey to heaven where his brothers and Draupadi had died before him.
When he finally reached heaven with a dog, he was invited by Indra but he had to leave the dog. He refused to do so and wanted to accompany the dog irrespective of where it went. The dog was Yama and it was one of their tests. Then he was sent to hell as a result of the sins he did and he found his brothers and wife there. After a while, they were transferred to heaven.