Chitragupta (Sanskrit: चित्रगुप्त, rich in secrets) is a Hindu God assigned with the task of keeping complete records of actions of human beings on the earth. Upon their death, Chitragupta has the task of deciding heaven or the hell for the humans, depending on their actions on the earth. Chitragupta Maharaj (Chitragupta the King) is the patron deity of Kayasthas, a Hindu caste of India.
According to the Vedic scriptures, the souls of men after death receive rewards and punishments according to their sins and virtues, and hence it is believed that good and bad deeds of men are not destroyed. The souls of men after death go to Yamapuri which is presided over by the deities called Yamas who keep records of men’s actions and accordingly give them their dues. The principal Yama is called Yamaraja or Dharamaraja, that is, the ruler of Yamapuri or the King of Laws.
The Yama Samhita which is an extract from the 9th Chapter of Ahilya Kamdhenu, a work of Hindu Law, says that Dharamaraja complained to Lord Brahma about his difficulties in performing his most responsible duties of keeping records of the deeds of men and doing justice to them. Lord Brahma went into meditation.Chitragupta sprang from his body and stood before him bearing an inkpot and a pen. The God Brahma (Creator) said: "Because you are sprung from my body (kaya), therefore you shall be called Kayastha and as you existed in my body unseen I give you the name of......