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.