The story of the night
The best-known telling comes from the Linga Purana. Brahma and Vishnu argue over which of them is greater, and a blazing pillar of fire rises between them. Brahma flies up as a swan to find its top, Vishnu digs down as a boar to find its base, and after thousands of years neither finds an end. Then Shiva steps out of the flame, and the first linga is born; tradition places that night on Maha Shivaratri.
Other traditions attach other stories to the same night: Shiva's cosmic dance, his wedding to Parvati, or the night he drank the halahala poison from the churning of the ocean and his throat turned blue. And the Shiva Purana tells of a hunter who hid in a bilva tree all night and, without knowing, dropped its leaves on a linga below, which is why the three-part bilva leaf is still the main offering.