The story of Arjuna typing up Yama, the Hindu god of death, is found in the Sarala Mahabharata. The incident happened during the final journey of the Pandavas and it involves Yudhisthira marrying Suhani.
Pandavas had given up their kingdom and were on their final journey to the Himalayas. During the journey they reached Dharmapuri near Jajpur on the banks of Baitarani River.
Hari Sahu, a trader in the region, came along with his daughter, Suhani, to meet Pandavas. The trader was disturbed and sad as he could not get his daughter married. Suhani was born in an inauspicious moment and she was destined to die at the time of her wedding. So no man was ready to marry her.
Hari Sahu knew that Yudhisthira was the son of Yama. Therefore he wanted Yudhisthira to marry Suhani.
At first, Yudhisthira was not ready to marry the girl and return to the life of a householder. He then told about his old age and his arduous journey in future.
But Hari Sahu was insistent.
Rejecting a girl offered in marriage by father was against dharma. The girl too wished to marry Yudhisthira. So finally Yudhisthira, who always followed Dharma, had to give consent.
Yudhisthira was worried that poor girl will die on the wedding day.
Arjuna promised Yudhisthira that he would not allow Yama to come near Suhani.
During the wedding ceremony, Arjuna stood behind Suhani.
As the wedding ceremony was progressing, the two lieutenants of Yama, Kal and Bikal, arrived. Arjuna tied them up.
Yama came to know about this transgression in his domain and soon arrived at the place of marriage. Although invisible to all the people present, Arjuna was able to sense the presence of Yama.
Arjuna humbly requested Yama to spare Suhani. Yama ignored his prayers and moved towards Suhani.
Arjuna used his bow and arrow and tied a rope thousand times around him. He then used an arrow to dispatch him to the Sumeru Mountain.
The wedding ceremony was over and Suhani escaped from the clutches of Yama.
Hari Sahu and those present in the wedding wanted to know how Suhani was spared by Yama. At first everyone thought, Suhani did not die because she had become the daughter-in-law of Yama. But Yama is the God of Dharma and he was never biased.
Sahadeva then told the gathering what had happened when the wedding ceremony was in progress.
Hari Sahu wanted to apologize to Yama. Arjuna then took him to the Sumeru Mountain.
Hari Sahu fell at the feet of Yama and requested for pardon. He also requested Arjuna to free Yama.
Arjuna agreed to free Yama if he gave the word that he would not harm Suhani. Yama gave his word.
Yudhisthira advised Suhani to go to Kapilash Hill and worship Shiva.
To protect Dharma, Yudhisthira returned from Vanaprastha (forest dweller) to Grihasthashram (householder). Arjuna fought with Yama to help a father and daughter find peace. The Pandavas again showed to the world that only by protecting Dharma can there be peace.