According to legend, saint Thirugnana Sambandar was singing verses praising Shiva at the nearby site and Shiva was mesmerized by the devotion.
The temple deity thus came to be known as Urugeswarar (urugu means mesmerize in Tamil and the image of the Sambandar is located in Urugeswarar temple axially outside the temple facing the Metraleeswar temple with folded hands.
As Shiva turned to the West to listen to the songs of Sambandar, the place came to be known as Thirumetrali and the presiding deity came to be known as Metralinathar. An old term is 'Thali', which means temple.
There is another legend that Vishnu was doing penance to attain the form of Shiva. Shiva appeared to him and informed that he had to continue his penance till Sambandar visits the place and sings praise of him.
The deity at the Urugeswarar temple was thus originally Vishnu, who was mesmerized by the devotion of Sambandar and changed to Shiva. It is believed that the 108 Rudras performed penance at this place and hence it is called "Ananda Rudresam" and "Maha Rudresam".
Appar and Sambandar, the 7th-century Tamil Saivite poet, venerated Metralinathar in one verse each in Tevaram, compiled as the First Tirumurai. As the temple is revered in Tevaram, it is classified as Paadal Petra Sthalam, one of the 275 temples that find mention in the Saiva canon.
Sundarar mentions that Shiva prefers to reside at this most happening place.
There are no historical evidence to assess the exact time the temple was built. There is an inscription in the temple indicating benevolent contributions from during the 13th century by Later Cholas to expand the temple.