Way up in the Himalayas, where the snow never melts, there once sat a Rakshasa performing severe penance. He was a devotee of Lord Shiva and had spent many, many hundreds of years, with no thought for food or clothe, heat or cold, sun or snow, sitting there, his mind fixed on Lord Shiva. “Shiva-Shiva, Shiva-Shiva, Shiva-Shiva.” His name was Bhasmasura.
After ages had passed thus, Shiva decided to bless him. So, one day, as Bhasmasura was meditating, the Lord appeared before him. He was shining like the morning sun.
He was the supreme ascetic, dressed in deer skin, body smeared with ashes, locks matted, the snakes dangling around his neck and arms, his hand holding aloft the divine Trishul. Ah, what a magnificent sight he made in all his ascetic glory! Bhasmasura’s eyes were dazzled. He was speechless with wonder at the Lord’s beautiful form:
Gently Shiva spoke to the awe-struck Bhasmasura. He said, “I am pleased with the severe penance you have performed. Ask of me any boon you desire.” And Bhasmasura thought, “I must indeed be a great Tapasvi, as Lord Shiva has granted me a boon.”
Aloud he said, “Lord, grant that whatever object I touch with my right hand will be immediately reduced to ashes.” “Shiva-Shiva.” Bhasmasura, even after going through such rigorous penance, yet, had an asuric mind. “Shiva-Shiva.” What a boon to ask for! Lord Shiva said, “Tathaastu! – so be it.”
Shiva granted this request, but Bhasmasura thereupon attempted to touch the head of Shiva with his hand because he saw Parvati and wanted to possess her, which would only be possible when he turned Shiva into ashes. Shiva fled, and was chased by Bhasmasura. Wherever Shiva went, Bhasmasura chased him.
Somehow, Shiva managed to reach Vishnu to seek a solution to this predicament. Vishnu on hearing Shiva’s problem, agreed to help him out.
Vishnu, in the form of Mohini, appeared in front of Bhasmasura. Mohini was so exceedingly beautiful that Bhasmasura immediately fell in love with Mohini. Bhasmasur asked her (Mohini) to marry him.
She told him that she was very fond of dancing, and would marry him only if he could match her moves identically. Bhasmasura agreed to the match and hence they started dancing. The feat went for days at an end. As Bhasmasura matched the disguised Vishnu’s move for move, he began to let his guard down. While still dancing, Mohini, struck a pose where her hand was placed on top of her own head. As Bhasmasura imitated her, he was tricked into touching his own head, and hence Bhasmasura immediately burnt up and turned into ashes, due to the power he had recently gained.
The other variation of this, in a nut shell, is: While Shiva was fleeing away, Vishnu appears in the form of Mohini. Bhasmasura forgets about the testing of newly acquired boon and asks Mohini to marry him. She agrees and asks Bhasmasura to take a dip in the lake and clean himself as he is not clean at the present condition. Bhasmasura is too happy to take a dip in the lake. He tries to get rid of the excess water in his hair (dries his hair) by running his hands over his head. Bhasmasura turned into ashes with the power of newly acquired boon.