The Story of Markandeya
Sage Mrikandu and his wife Marudvati worshipped Shiva diligently. They were longing for a son. One day Shiva appeared before them and presented them with two choices. They could either have a righteous son, who follows the path of Dharma and always listens to his parents but with one contingency that he would only live for 16 years. The other choice was to have a son who would live a normal life but would be evil, would not listen, and would not follow the path of dharma. Mrikandu chose the first option.
With Shiv’s blessings, they had a son whom they named Markandeya. Markandeya was a great devotee of Shiva and was, of course, righteous and good. On the day that he was supposed to die, Markandaya was in deep meditation next to a shiva lingam. He was hugging the Shivlingam and praying. The messengers of Yama, who is the god of death, tried to take Markandeya but were unable to because of his deep meditative state. They were not able to move him. Yama then personally came to take his life. He threw his noose at Markandaya. By mistake, the noose landed around the shiva lingam as Markandeya was hugging the Shivalingam. An enraged physical form of Shiva came out of Shivlingam and attacked Yama. Yama realized his mistake and apologized. Shiva was very happy with Markandeya’s devotion and meditation. He paused time for him and gave him a boon of immortality. So now, Markandaya would live forever as a 16-year-old.
You might be wondering that did not Shiva break his promise as he said Markandaya would live for only 16 years but then gave him immortality boon.
A logical explanation is the following:
Shiva gave two options to Sage Mrikandu. One of the options was a son who will live for 16yrs. Markandeya lived for 16 yrs. and then time stopped for him. He became immortal but remained 16yrs. Therefore, Shiva kept his words that the boy will live for 16 yrs.
Shiva never said that he would die at 16 yrs. There is a huge difference between living for 16 yrs. and dying at 16 yrs.
Another explanation to answer this question is that you can change your destiny by your karma. Shivji listens to prayers, devotion, and meditation and finds a way to keep his words while still granting new blessings and boons.
Remember, the story of Savitri and Satyavan. Savitri was able to bring her husband back from Yama. Satyavan was destined to die on one particular day but Savitri changed that.
Markandeya became a great Rishi. Maha Mrityunjaya mantra is ascribed to him, Markandeya Puran has the conversation between Rishi Markandeya and Jaimini. It also contains Devi Mahatmaya. Bhagwatam also has stories of Markandeya.
It is commonly believed that Mahamrityunjaya mantra is to push away the death and for healing. Actually, Mahamrityunjaya mantra is to destroy the karmas. It relieves people of their karmas of this birth and thus may bring the bodily death.