Chandra Devan worshipped Siva at this spot to rid himself of the curse of Daksha.
Chandra Devan is considered to have built this temple & hence the name Somanathar to the Lord. Chandran fell in love with Rohini, one of the daughters of Dakshan. But Dakshan wanted to give all his daughters in marraige to one able & loving person, who would treat all his daughters equally. Chandran got married to all, but his love for Rohini was too great & the other daughters complained to their father. Dakshan cursed Chandran to dwindle in power & beauty.
When Chandran begged forgiveness, Dakshan said that only prayers to Lord Shiva could free him of the curse. Chandran came to Somanath & prayed to Lord Siva, doing penance for about 4,000 years. Lord Siva appeared & said that he could not fully absolve him of the curse. Instead, he would wane in 15 days, but would grow again. This is the story said for the waxing & waning of the moon, producing new moon & full moon.