The Brahmanda Purana 14.46ff narrates the following story of Kalayavana's birth: a woman named Vrka-devi decided to test the virility of Gargya (IAST: Gārgya, "descendent of Garga"). Gargya was unable to ejaculate, for which the Yadavas insulted him. After a 12-year penance, Gargya got a boon from Mahadeva that he would get a son with the power to destroy the Yadavas. During his penance, he ate iron fillings that made his complexion iron-black (kāla). Subsequently, Gargya came to Mathura, and had sex with a cowherd's daughter (gopi), who was actually an apsara in disguise. Kalayavana was the result of this union: Gargya crowned him as the new king, and left for the forest.[4]
Jarasandha, Kamsa's father-in-law, and the ruler of Magadha attacked Mathura seventeen times, but was beaten by Krishna every time. Unable to defeat Krishna on his own, Jarasandha made an alliance with Kalayavana. Kalayavana had become a powerful Yavana warrior, who had gotten a boon from Shiva that on the battlefield, he would be unbeatable.[7]
Krishna, in order to defend his people, built a formidable city, named Dvaraka, to which he transported the inhabitants of Mathura.[8] Kalayavana attacked Mathura with an army of 30 million Yavanas. Krishna, realising that the Yavanas had greatly outnumbered all the Yadavas, decided to challenge Kalayavana for a duel. Krishna strategically fled the battlefield and lured Kalayavana into the cave where the great king of Treta Yuga, Muchukunda, one of the forefathers of Rama, was in a deep slumber of thousands of years after helping the devas in an epic war with the asuras.[9]
Desiring an absolutely undisturbed sleep, he had been given a boon by Indra that anyone who dared to disturb his sleep would get burnt to ashes immediately.[7] In the Dvapara Yuga, in the darkness deep inside the cave, Krishna covered Muchukunda with his scarf. Kalayavana, assuming him to be Krishna, kicked him, thus disturbing the king's sleep, and was reduced to ashes. Muchukunda was delighted to see Krishna there. Krishna advised him to perform tapasya to cleanse his accumulated sins to attain moksha. After meeting the deity, Muchukunda set out of the cave. Muchukunda then travelled north to Gandamadana Mountain, and from there, to Badrikashrama, for doing penance and finally achieved liberation in the form of moksha.[10][11]
In popular culture
The hills and the cave where Muchukunda rested is held by locals to be located at Ranchodji teerth, district Lalitpur, in the state of Uttar Pradesh.[12]