This temple was built during the reign of Kulothuna I Chola during 1060 A.D-1118 AD. This temple was later renovated by Vijayanagara Kings. It is believed that taking a bath in Surya Pushkarini (Temple tank) will relieve Dosha. Jnana Koopam temple tank is located inside the temple.
As per the legends, Sage Kalava Muni prayed Navagrahas for the cure from leprosy disease. Navagrahas granted the boon and Sage recovered from the disease. Angered Brahma Cursed Navagrahas to suffer from Leprosy disease. Navagrahas has to act as per the Karma but they cannot grant boon on their own. Navagrahas came down to the Earth and did penance for Lord Siva in Vellerukku Vahanam (Jungle filled with white flowers). Impressed Lord Siva appeared before them and granted the boon that each Graha will have their own place of worship.