The story of the origin of Maha Mrityunjaya Mantra is associated with Young Sage Markandeya. He wrote and chanted this is powerful Shiva mantra to escape from the clutches of Yama, the Hindu god of death. Thus this great mantra conquers fear of death and provides long life to one who chants it.
Sage Mrikandu and Marudvati had no children. Mrikandu Rishi was an ardent devotee of Shiva. Day for the rishi began with Shiva and ended with Shiva. But the rishi never asked for anything from Shiva. Seeing his wife in pain in not having any children, Sage Mrikandu decided to ask Shiva for a solution.
Shiva who is Bholenath is ever ready to help his ardent devotees. Shiva appeared before the Sage and gave him an option – 100 sons who are foolish or one son who will be intelligent but with a short life. Sage Mrikandu opted for an intelligent son – who will only live for 16 years.
Soon a son was born to the couple, they named him Markandeya. He showed great intelligence from childhood and learned all the shastras and Vedas.
Young Markandeya realized that his parents were never happy with his achievements.
Soon he discovered the reason for his parent’s sadness – he would only live on earth for 16 years.
Markandeya was confident that Shiva will give him a solution to escape death at a young age.
Markandeya soon created a Shivling and started offering worship. He performed pujas and created a mantra to chant at all times. This mantra is the famous Mahamrityunjay Mantra
ॐ त्र्यम्बकं यजामहे सुगन्धिं पुष्टिवर्धनम्।
उर्वारुकमिव बन्धनान् मृत्योर्मुक्षीय मामृतात्॥
Om Trya-Ambakam Yajaamahe Sugandhim Pusstti-Vardhanam
Urvaarukam-Iva Bandhanaan Mrtyor-Mukssiiya Maa (A)mrtaat
On his 16th day birthday, Yama the god of death appeared to take away the life of Markandeya.
Markandeya clung to the Shivling chanting the Mahamrityunjaya Mantra. When Yama started to use force, Shiva appeared in full fury. Yama could not stand before the fury of Shiva. He disappeared leaving the young Markandeya.
Shiva then blessed young Markandeya with immortality.