Kayasthas as in the Puranas
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. Shree 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 Chitragupta.” He then assumed charge of Yamapuri. Dharma Sharma married his daughter Irawati to Chitragupta and Manuji, son of Surya (the Sun) married his daughter Sudakhina to him.” Chitragupta had eight sons from the former and. four from the latter and these twelve sons became the progenitors of the twelve sub?divisions of the Chitraguptavansi Kayasthas, namely, Mathur, Gaur, Nigam, Ashthana, Kulshretha, Suryadwaja, Balmika Bhatnagar, Srivastava,Ambastha, Saksena and Karana.
In Padma Purana, Uttar Khanda, it says that Shree Chitragupta had twelve sons by two wives. They were all invested with the sacred thread and were married to Nagakanyas. They were the ancestors of the twelve sub-divisions of the Kayasthas.
The same legend with some slight difference is given in most of the Puranas.
Padma Purana after stating the legend says: “Shree Chitragupta was placed near Dharamaraj to register the good and evil actions of all sentient beings,that he was possessed of supernatural wisdom and became the partaker of sacrifices offered to the gods and fire. It is for this reason that the twice born always give him oblations from their food. As he sprang from the body of Lord Brahma he was called Kayastha of numerous gotras on the face of the earth.”
In Shristhi Khanda the same Purana says that the sacrificial rites and study of the Kayasthas should be of the Vedas and supporting scriptures and their occupation related to writing.
Bhavishya Purana states that God, the Creator, gave the name and duties of Chitragupta as follows:
Because you have sprung from my body, therefore, you shall be called Kayastha and shall be famous in the world by the name of Chitragupta. Oh my son, let your residence be always in the region of the god of justice for the purpose of determining the merits and demerits of men.
Vignana Tantra says the same thing.
The same is the enjoinment of Lord Brahma to Shree Chitragupta according to Brihat Brahma Khanda. He was named Kayastha having sprung from the body (kaya) of Lord Brahma. He was directed to perform all sanskars and to have writing as his profession.
Garuda Purana describes the imperial throne of Shree Chitragupta in Yamapuri holding his Court and dispensing justice according to the deeds of men and maintaining their record, in the following words:
(There Dharmaraja, Chitragupta, Sravana and others see all sins and virtues which remain concealed in the bodies of men).
Similarly, Apastamba Shakha of the Veda quoted in Shabda?Kalpadrum 2nd part, page 228, Shabda 20, under Kshatriya, states that Kayasthas are Kshatriyas. Chitragupta who reigns in heaven and his son Chaitrarath, who was light of the family, meritorious and of illustrious deads ruled on earth for a long time as King of Chitrakoot near Allahabad. Meru Tantra quoted in Shabda?Kalpadrum under the word "Kshatriya" supports the same view.
The Mahabharata (Anusasan Parva, Chap. 130) recites the teaching of Shree Chitragupta requiring men to do virtuous and charitable acts and performing Yagya, saying that men are rewarded or punished according to their good or bad deeds.