Once the King of Devas Lord Indiran & his followers disrespected the garland of Goddess Aadhiparasakthi and were cursed by the Rishi Dhurvasar. Due to this curse Devas also attained human forms and suffers the diseases which the human beings are subjected to, like, body ailments, gray hair, old age, death, etc., Due to these sufferings, the strength of Devendiran was reduced. He sought the assistance of Lord Brahma to pray before the Lord Maha Vishnu. As suggested by Lord Vishnu, that the Devas should consume the Nector (Amirdham) which is obtained after churning the milk sea. Accordingly, mountain Meru which was rested over the Tortoise (an incarnation of Lord Maha Vishnu himself), the mountain Meru was held by the Cobra Vasugi who has 1000 tongues, holding the tail by Devas and Asuras holding the head of it, milk sea was churned. The thousand tongues cobra was turned which caused heat and unable to bear the heat, the Cobra spit the poison. The poison emerges over the ocean. The entire ocean became dark. The Devas ran out with fear. They went to Thirukailai. They worshipped Lord Shiva, with the permission of Lord Nandhi. Listening to the pleas made by the Devas, Lord Shiva directed the disciple, Anukka Thondar Sundarar to bring the Alagala Poison. Anukka Thondar Sundarar was a replica of Lord Shiva who gathered the poison and gave it to Lord Shiva. As the poison would cause havoc, Lord Shiva swallowed it. Lord Shiva is embodiment of the entire universe, and the poison may kill the living beings. If Lord Shiva spit it out, the living beings in the surroundings would be destructed. Therefore, Goddess Ambikai swiftly acted and held the neck of the Lord Shiva with Her hands. The poison caused the neck bluish. Hence Lord Shiva is known as Thiruneelakandamurthy here.
The poison caused Lord Shiva to soon. The Devas and Rishis worried over the plight of Lord Shiva and the entire 33 crores Devas and Rishis started penance that the poison should not harm the Lord Shiva and benefit him. Lord Shiva understood the respect and through prays and penance of 33 crores of Devas and Rishis in the entire night. Woke up as are experiments and pretend to be resuming and opened his eyes. The smile Lord Shiva caused happiness to the entire assembly. This day is called Mahashivarathiri. The night is called Mahashivarathiri during the period which the Devas and Rishis did not eat or sleep. Naturally, this prays were the sanctum, sanctorum Shivarathiri is followed here.