As per Hindu legend, the temple was believed to have been built by two asuras (demons) named Onan and Kanthan. The asuras got a lingam (an iconic representation of Shiva) from a forest in the region and became ardent devotees.
On account of their devotion, they got all the desired boons.There was a third asura, Jalandeeswaran, who joined the two, and became an ardent devotee of Shiva. The three shrines in the temple, each dedicated to Onakantheeswarar, Salantheeswarar and Jalandeeswarar are believed to be the respective shrines built by the demons.
Sundarar, a 7th-century Tamil Saivite poet, venerated Ona Kantheeswarar in one verse in Tevaram, compiled as the Seventh 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.
It is believed that he got back one of his eyes which he lost on account of not keeping his word in the Ekambanathar Temple.
To test his devotion, Shiva moved toward a tamarind tree and Sundarar followed his footsteps and sung praises of Shiva. His devotion was admired and Shiva turned the tamarind leaves to golden leaves and poured on him from the skies.