According to the Hindu legend, Shiva sent sage Agastya to this place to balance the weight of gods attending his marriage with Paravathi. At the spot where the temple now stands, the sage Agastya witnessed the marriage of Shiva and Parvathi. The sage installed a lingam behind the main lingam in the temple to worship Shiva. As per another legend, one of the 63 nayanmars, Amaraneethi Nayanar, spent his life supplying undergarments to all worshipers of Shiva. Shiva wanted to test his devotion and appeared to him in the form of a Brahmin. The Brahmin deposited a piece of rag in the custody of Amaraneethi, which was lost by a trick. The Brahmin demanded equal weight of gold in return of the lost rag. Amaraneethi deposited all his wealth in one side of a scale pan, but it did not balance. Finally, he submitted himself and his wife in the scale pan. Shiva was pleased by the devotion of the nayanar and bestowed him with all his wishes.