Yama ( ) or Yamarāja is a Hindu and Buddhist deity of death, dharma, the south direction, and the underworld, belonging to an early stratum of Rigvedic Hindu deities. In Sanskrit, his name can be interpreted to mean "twin". He is also an important deity worshipped in Kalasha and now extinct Nuristani religions suggesting his prominence in pre-Vedic Indo-Aryan religion.  
According to the Vishnu Purana, Yama is the son of sun-god Surya and Sandhya, the daughter of Vishvakarma. Yama is the brother of Sraddhadeva Manu and of his older sister Yami, which Horace Hayman Wilson indicates to mean the Yamuna. According to the Vedas, Yama is said to have been the first mortal who died. By virtue of precedence, he became the ruler of the departed, and is called "Lord of the Pitrs".
Mentioned in the Pāli Canon of Theravada Buddhism, Yama subsequently entered Buddhist mythology in East Asia, Southeast Asia and Sri Lanka as a Dharmapala under various transliterations. He is otherwise also called as "Dharmaraja".
In Hinduism, Yama is the lokapala ("Guardian of the Directions") of the south and the son of Surya. Three hymns (10, 14, and 35) in the 10th book of the Rig Veda are addressed to him. In Puranas, Yama is described as having four arms, protruding fangs, and complexion of storm clouds with a wrathful expression; surrounded by a garland of flames; dressed in red, yellow, or blue garments; holding a noose and a mace or sword; and riding a water-buffalo. He wields a noose with which he seizes the lives of people who are about to die. Yama is the son of Surya and Saranyu. He is the twin brother of Yami, brother of Shraddhadeva Manu and the step brother of Shani and his son was Katila. There are several temples across India dedicated to Yama.
In Buddhism, Yama (Sanskrit: यम) is a dharmapala, a wrathful god or the Enlightened Protector of Buddhism that is considered worldly, said to judge the dead and preside over the Narakas ("Hell" or "Purgatory") and the cycle of rebirth.
The Buddhist Yama has, however, developed different myths and different functions from the Hindu deity. In Pali Canon Buddhist myths, Yama takes those who have mistreated elders, holy spirits, or their parents when they die. Contrary though, in the Majjhima Nikaya commentary by Buddhagosa, Yama is a vimānapeta – a preta with occasional suffering.
In other parts of Buddhism, Yama's main duty is to watch over purgatorial aspects of Hell (the underworld), and has no relation to rebirth. His sole purpose is to maintain the relationships between spirits that pass through the ten courts, similar to Yama's representation in several Chinese religions.
In Chinese texts, Yama only holds transitional places in Hell where he oversaw the deceased before he, and the Generals of Five Paths, were assigned a course of rebirth. Yama was later placed as a King in the Fifth Court when texts led to the fruition of the underworld that marked the beginnings of systemizations.
Yama can be found in one of the oldest Japanese religious works called Nipponkoku Genpō Zenaku Ryōiki, a literary work compiled by the Monk Keikai in 822. Yama was introduced to Japan through Buddhism, where he was featured as a Buddhist divinity. He holds the same position title as other works depict him – a judge who imposes decisions on the dead who have mistreated others.
Naraka in Hinduism serves only as a temporary purgatory where the soul is purified of sin by its suffering. In Hindu mythology, Naraka holds many hells, and Yama directs departed souls to the appropriate one. Even elevated Mukti-yogyas and Nitya-samsarins can experience Naraka for expiation of sins.
Although Yama is the lord of Naraka, he may also direct the soul to a Swarga (heaven) or return it to Bhoomi (earth). As good and bad deeds are not considered to cancel each other out, the same soul may spend time in both a hell and a heaven. The seven Swargas are: Bhuvas, Swas (governed by Indra), Tharus, Thaarus, Savithaa, Prapithaa, and Maha (governed by Brahma).
The idea of Naraka in Sikhism is like the idea of Hell. One's soul, however, is confined to 8.4 million life cycles before taking birth as a human, the point of human life being one where one attains salvation, the salvation being sach khand. The idea of khand comes in multiple levels of such heavens, the highest being merging with God as one. The idea of Hell comes in multiple levels, and hell itself can manifest within human life itself. The Sikh idea of hell is where one is apart from naama and the Guru's charana (God's lotus feet (abode)). Without naama one is damned. Naama is believed to be a direct deliverance by God to humanity in the form of Guru Nanak. A Sikh is hence required to take the Amrit (holy nectar/water) from gurubani, panj pyare (khanda da pahul) to come closer to naama. A true Sikh of the Gurus has the Guru himself manifest and takes that person into sach khand.
In the Jātakas the Narakas are mentioned as Yama's abode (referred to in Pali as Yamakkhaya, Yamanivesana, Yamasādana, etc). It is also noted that all of Samsāra is subject to Yama's rule, and escape from samsāra means escape from Yama's influence.
The Vetaranī River is said to form the boundary of Yama's kingdom. Elsewhere, it is referred to as consisting of Ussadaniraya (Pali; Sanskrit: Ussadanaraka), the four woeful planes, or the preta realm.
Naraka is usually translated into English as "hell" or "purgatory". A Naraka differs from the hells of western religions in two respects. First, beings are not sent to Naraka as the result of a divine judgment and punishment; second, the length of a being's stay in a Naraka is not eternal, though it is usually very long. Instead, a being is born into a Naraka as a direct result of his or her previous karma (actions of body, speech and mind), and resides there for a finite length of time until his karma has exhausted its cumulate effect.
Mandarin Diyu, Japanese Jigoku, Korean Jiok, Vietnamese Địa ngục literally "earth prison", is the realm of the dead or "hell" in Chinese mythology and Japanese mythology. It is based upon the Buddhist concept of Naraka combined with local afterlife beliefs. Incorporating ideas from Taoism and Buddhism as well as traditional religion in China, Di Yu is a kind of purgatory place which serves not only to punish but also to renew spirits ready for their next incarnation. This is interchangeable with the concept of Naraka.
In Japanese mythology, Enma-O or Enma Dai-O ( , Great King Enma) judges souls in Meido, the kingdom of the waiting dead. Those deemed too horrible are sent to Jigoku, a land more comparable to the Christian hell. It is a land of eternal toil and punishment. Those of middle note remain in meido for a period awaiting reincarnation. Others, of high note, become honored ancestors, watching over their descendants.
In the Zend-Avesta of Zoroastrianism, a parallel character is called "Yima". The pronunciation "Yima" is peculiar to the Avestan dialect; in most Iranian dialects, including Old Persian, the name would have been "Yama". In the Avesta, the emphasis is on Yima's character as one of the first mortals and as a great king of men. Over time, *Yamaxšaita was transformed into Jamšēd or Jamshid, celebrated as the greatest of the early shahs of the world. Both Yamas in Zoroastrian and Hindu myth guard hell with the help of two four-eyed dogs.
It has also been suggested by I. M. Steblin-Kamensky that the cult of Yima was adopted by the Finno-Ugrians. According to this theory, in Finnish Yama became the god cult Jumula and Joma in Komi.[dubious ] According to this hypothesis, from this cult, the Hungarians also borrowed the word vara which became vár 'fortress' and város 'town'. (ibid)
There is a door-god Yamadipati in Javanese culture, preserved especially in wayang. The word adipati means ruler or commander. When Hinduism first came to Java, Yama was still the same as Yama in Hindu myth. Later, as Islam replaced Hinduism as the majority religion of Java, Yama was demystified by Walisanga, who ruled at that time. So, in Javanese, Yama became a new character. He is the son of Sanghyang Ismaya and Dewi Sanggani. In the Wayang legend, Yamadipati married Dewi Mumpuni. Unfortunately, Dewi Mumpuni fell in love with Nagatatmala, son of Hyang Anantaboga, who rules the earth. Dewi Mumpuni eventually left Yamadipati, however.
In the Buddhism of the Far East, Yama is one of the twelve Devas, as guardian deities, who are found in or around Buddhist shrines (Jūni-ten, 十二天). In Japan, he has been called "Enma-Ten". He joins these other eleven Devas of Buddhism, found in Japan and other parts of southeast Asia: Indra (Taishaku-ten), Agni (Ka-ten), Yama (Emma-ten), Nirrti (Rasetsu-ten), Vayu (Fu-ten), Ishana (Ishana-ten), Kubera (Tamon-ten), Varuna (Sui-ten) Brahma (Bon-ten), Prithvi (Chi-ten), Surya (Nit-ten), Chandra (Gat-ten).