Thousands of years ago, in a forest, Sage Durvasa was performing puja to Lord Shiva. One of the Celestial from Deva Loga who happened to pass by mocked at the manner in which Sage Durvasa was performing Lord Shiva puja, without knowing who the sage was. Further mimicking like a Crab, the celestial disturbed his puja. Angered by the unwarranted act the sage cursed him to born a Crab on earth.
When the Celestial realized who the sage was, he immediately sought pardon and asked for reversal of the curse but the sage would not take back the curse and said he had to undergo punishment on earth for certain period and to get released of the curse for which he has to perform puja to Lord Shiva offering a Lotus flower every day. At appropriate time Lord Shiva himself will manifest and repeal the curse to make him a Celestial again. Therefore the Celestial instantly became a Crab and went to the earth.
The place where the Celestial had born a Crab was the present site of Lord Karkateshwarar Temple which was then in the midst of paddy fields surrounded by gutters from all sides. Lord Shiva had already enshrined himself there in the form of a Shiva Ling for some unknown reason. There was a big pond full of Lotus flowers inside that area. Therefore there was no difficulty for the Crab to perform puja to Lord Shiva with one Lotus flower every day.
As this was happening on one side, on the other side Lord Indira too was performing puja to Lord Shiva in the same site offering 1008 Lotus flowers every day. Lord Indira after fighting several battles with Asuras had lost much of his powers and therefore on the advice of Guru Bhagavan, to regain the lost powers he was performing the Shiva puja there by daily offering 1008 Lotus flowers for 48 days. For this purpose Lord Varuna had ensured that 1008 Lotus flowers bloomed everyday in that pond to enable Lord Indira to perform the Puja.
Unaware of the story, the Crab came to that site to perform puja to Lord Shiva as plenty of Lotus flowers were blooming every morning. The Crab began to pluck a flower everyday and dragged it through the same pond to place it over the head of Shiva Ling to perform puja as advised to it.
At the same time unaware that one out of 1008 flowers was missing everyday, Lord Indira continued to perform daily puja with with only 1007 Lotus flowers without counting the flowers before offering to the Lord because Lord Varuna had already ensured that 1008 Lotus flowers bloomed every day in that pond. The Crab concentrated on his work.
As time passed, one day Lord Guru happened to notice that the puja performed by Lord Indira was not accepted by the Lord as only 1007 flowers were placed on Shiva Ling instead of 1008 flowers. Lord Guru immediately brought this to the attention of Lord Indira and he too was shocked. Lord Varuna confirmed that daily in the morning he counted 1008 Lotus flowers and left the place. Therefore Lord Indira kept vigil in the morning to see what was happening to the 1008 th flower which was daily missing. As he was watching the pond he saw a Crab plucking one flower and taking it to Shiva Ling and performed puja.
Angered at the sight when Lord Indira tried to kill the Crab with his sword, a hole appeared in Shiva Ling and the Crab entered into the hole to escape death. Alas, it instantly became a Celestial and sought pardon from Lord Indira for the act which he did unknowingly. Lord Shiva too manifested before them to bless both and after revealing the truth, he asked Lord Indira to perform another 1008 days puja to get back all the powers lost by him. Lord Indira did puja as ordered by the Lord Shiva and got back the lost powers. Thereafter both the Celestial and Lord Indira returned back to their places. Lord Shiva continued to stay there deep inside the ground below in the form of a Shiva Ling.
Few thousand years had passed and a King from Chola Dynasty was ruling the state. Once the King was afflicted with severe paralysis disease and none could cure him.He was bed ridden. One day Lord Shiva and Goddess Parvathi went to the Palace in the guise of physician and after examining the bedridden King, they applied some Veebuthi (sacred ash powder) on his forehead, gave him a Rudraksha beed mala (neck chain) and poured some holy water into his mouth and went away saying they will again visit him the next day to continue the treatment. Next day morning the King got up from the bed as if nothing had happened to him. He looked hale and healthy, performed his daily chores much to the shock and surprise of everyone in the Palace. How did the disease vanish in 24 hours was a mystery in the minds of everyone including the King. In the morning the physicians again came and were warmly welcomed by the King and treated with great honour. He offered them several costly gifts of gold and diamond but they politely declined to accept any of them saying they only did their state duty and instead told him of a place where a Shiva Ling along with a idol of Goddess Parvathi lay buried and it should be taken out and a temple built in the same place in honour of Lord Shiva so that his Kingdom will remain prosperous .
Next morning the King went to the spot accompanied by those two physicians. The land was dug and soon the workers were able to find the Shiva Ling intact, but not the idol of Goddess Parvathi. When the King tried to reach out the physicians to find out where would be the idol of Goddess Parvathi they were not found there. Nobody could locate them. The King realized that the Lord has come in the guise of physician and therefore as per the advice received by him earlier, he built a temple at the same sight and enshrined the Shiva Ling and an idol of Goddess Parvathi which he got sculpted out of a rock. However after several days when the labourers were digging another area they were able to recover the original idol of the goddess which was referred by the physicians. The original idol of the Goddess was also taken out and enshrined in the same temple in another sanctum.
In days to come the King heard through some saints the greatness of the Shiva Ling connected to Sage Durvasa and Lord Indira. As the real story spread, people began to call the presiding deity as Lord Karkateshwarar (Karkat meaning Crab) as he blessed a Crab to get back to his real form and the Goddess as Arumarundunayaki (Marunthu meaning medicine) because she came in the form of a physician to treat the King to cure the disease. The original idol of the Goddess was called Aboorvanayagi (Aboorva meaning rare). Since the Crab got relieved of its sin, this temple became Pariharasthal for those whose Zodiac sign is Cancer and Ahilya star.
The unique feature in this temple is that the Goddess Parvathi is enshrined in two separate sanctums in two different forms. In no other Lord Shiva temples Goddess Parvathi is enshrined in two separate sanctums in two different forms.
Unlike in other temples where Lord Chandra is in standing posture, here the Lord is seated in Yoga Posture which is very rare. Again Lord Danvanthri, lord of medicines who is normally seen enshrined in Lord Vishnu temples, is also enshrined in a separate sanctum as Lord Shiva and Goddess Parvathi took the form of physicians and treated the disease of the King. Those afflicted with any disease when they visit this shrine and pray for cure, Lord Danvanthri on behalf of Lord Shiva and Goddess Parvathi cures of their diseases so goes the belief.