Yama came to be the god of death in later mythology, but he had wide range of roles in the earlier mythology. In the Rigveda Yama was one of the first pair. As such he was referred to as the first mortal (later being called the first human). His twin sister Yami wanted him as her partner, but he refused. Later mythology charged him with incest. In the earliest mythology he was the son of Vivasvat, an early solar deity. Later he was assimilated into Dharma, god of social order, and made one of the guardians of the four corners of the earth (Lokapalas). Yama was personified in the Katha Upanishad, and his talk with the youth Nachiketas about the nature of death and its mystery portrayed him as a great philosopher-teacher.
During his evolution in later mythology Yama became more sinister, the feared god of death. His two dogs, Syama and Sabala, came for souls, no longer leading them to Devayana (way of the gods) or Pityana (way of the departed ancestor spirits), but to a stopover in Patiala (hell). Patala too had changed from a comfortable abode of the dead to a realm of punishment populated with all sorts of dreadful creatures: rakshasas (blood-thirsty demons), yakshas (tree spirits), ganas (dwarves), and angiras (a class of ghosts), as well as souls of the dead. Yama became associated with time as a killer (Kala) and death (Mrityu), and thereby with the lord of the cremation ground, Siva.