There are a
number of legends connected with the origin of Shivaratri. One is that Goddess Parvati and Lord Shiva were married on this day.
Our own Arunachala legend, proclaims it to be the day Lord Shiva appeared as a
luminous Jyotirlingam before Brahma and Vishnu.
And it is believed that on the day of Mahashivaratri, all
twelve Jyotirlingams of India manifested.
The Shiva Purana relates another legend extolling the glory of Mahashivaratri:-“In ancient times, a Bheel (forest inhabitant) named Gurudruha trudged through a forest to hunt deer. At night, without having sighted a single animal, he climbed a Bilva (Aegle marmelos) tree on the banks of a lake. Later at night, a doe arrived to drink water. Gurudruha aimed his bow and arrow at her. While aiming, he unknowingly dropped some Bilva leaves and his drinking water below on a Shivalingam that happened to be under the tree. The deer then requested him to allow her to entrust her fawns to her husband, after which she would return. After much haggling he agreed.
While awaiting her return, he stayed awake by aimlessly plucking leaves and dropping them below. Again they fell on the Shivalingam. Thus he unknowingly performed its puja (worship) while remaining awake all night. Finally the doe returned with her family, She informed him that along with her, he'd have to kill her family too. As he aimed, some more leaves fluttered down on the Shivalingam.
The collective punya (spiritual merit) accrued from the puja performed unknowingly, eradicated all his sins. This purified his heart. Repenting his flawed life of sin, he set the deer free. As he sat repenting, Lord Shiva manifested in front of him and granted him a boon, "You shall be born in a town known as Shrungver, as a man named Gruha. Lord Vishnu will grace your home as Lord Rama and redeem you." (This event is described in the Ramayana.) Shiva also blessed the deer, which attained a better destiny.”
To read an earlier post with more legends of the origin of Mahashivaratri and also explains its esoteric significance, go to this link
here.