Ravana was the great devotee of Shiva. He was an intelligent brahmin who had knowledge of all Veda and Shastra. Along with that, he was an extremely powerful demon.
Ravana had 10 heads so he was known as Dashanan. His brother was Kuber who is the deity of wealth.
With so many qualities, Ravana was very arrogant and ambitious too.
Dashanan Lifted Kailash
In the past Dashanan made a palace for Mahadev and tried to bring Him with him in Lanka but failed. He was the best devotee and wanted his adorable God to be with him.
When all his efforts failed, he tried to lift the whole Kailash mountain. Shiva knew that Ravana was completely capable of doing that. So He increased the weight by pressing the mountain with His toe.
Ravana wasn’t able to handle the increase weight and dropped the mountain. His hands got caught under it. With pain and anguish, he cried so loudly that the whole three worlds heard its thunder.
To please Shiva, Ravana created a stotra and sung it as prayer. Shiva felt delighted with the beautifully created stotra and gave it the name, Shiv Tandav Stotra.
Shiva relieved him by releasing his hands from the mountain and gave him a new name, Ravana. Before that he was always known as Dashanan. Shiva also offered him His Chandrahas Khadag.
Foundation of Baijnath Jyotirlinga
Ravana again requested Mahadev to come with him. So Shiva gave a Shiva Linga and told him to put that anywhere he wish Mahadev to reside.
Ravana happily started his journey from Kailash to Lanka. In the path he wished to drink some water. Ganesha, in the disguise of cowherd named Baiju, came and gave him some water. With the help of Varun dev, he compressed a lot of water into a small jug.
Ravana drank and felt natural emergency. He asked Baiju to hold Shiva Linga till he return back. Baiju put it on ground and installed it there. When Ravana saw the Shiva Linga, he felt cheated. With anger, he tried to physically hurt the Jyotirlinga. From that day, he turned to a monster from a great devotee.
Since then the place is known as Baijnath.