One of names of Lord Shiva is Neelkantha – he who has a blue neck. Lord Shiva got the blue neck after drinking the lethal poison, Halahala, during the Churning of Ocean (Samudra Manthan) to get Amrita (elixir of life). While the ocean of milk was being churned by the Devas – Demi gods) and Asuras (Demons) using Snake Vasuki as rope, the first thing to appear was a dark sticky foam. It was the dreaded poison Halahala, which had the power to destroy the universe.
The poison started emitting fumes and soon started to spread in water and air. Lord Shiva soon realized that the poison had the power to destroy the cosmos and immediately gathered the poisonous foam in his hands and drank it to save the world.
Goddess Parvathi, got alarmed about the safety of her husband Lord Shiva, caught hold of his neck to avoid poison from entering His body. The poison remained in the throat of Shiva making it blue colored.