The Yama legend- There are two legends associated with this festival. The first one goes like there was a 16 year old son of King Hima whose horoscope predicted his early death by a snake-bite on the fourth day of his wedding.
The newly-wed wife of the prince was cunning. She did not allow him to sleep on the fourth day of the wedding and she laid out all her ornaments accompanied with heaps of gold and silver coins at the entrance of the sleeping chamber and lit lamps all over the place. Then she started singing melodious songs to keep her husband from falling asleep.
When Yamraj (Death God) came to take the prince in the guise of snake, his eyes got dazzled and he was temporarily blinded by the sharp light of lamps and jewellery. The serpent was not able to enter the chamber till morning and therefore, he climbed on top of the gold coin heap and sat there the entire night enjoying the songs sung by prince’s wife. In the morning, he silently went away.
This saved the young prince from his early death and since then this day is celebrated as Dhanteras or Yamadeepdaan. In few houses ladies light earthen lamps or ‘deep’ and these are kept burning throughout the night to glorify Yama (the god of Death).
Dhanvantari myth-According to the other legend in the cosmic battle between the gods and the demons when both churned the ocean for ‘amrit’ or divine nectar, Dhanvantari – the physician of the gods and an incarnation of Vishnu – emerged carrying a pot of the elixir. So, according to this mythological tale, the word Dhanteras comes from the name Dhanvantari, the divine doctor.