As per local legend, the Nayak king Thirumalai Nayak suffered from stomach pain and he arrived at Madavar Vilagam in an ivory palanquin and stayed there for 48 days. He was completely cured and as a mark of his gratitude, he constructed the Natarajar hall as in Madurai Meenakshi temple. He also built drum halls from the temple to Madurai as he would take his midday meal only after hearing the drum sounds indicating the mid day pooja is complete in the temple.
The Temple
The temple has a five-tiered gopuram and large precincts. The central shrine is that of Vaidyanathar present as lingam in the inner most sanctum. The first precinct around the sanctum has the metal images of Somaskanda and stone sculptures of Nataraja, Durga, Dakshinamoorthy, Surya. The shrine of Sivakami is located in a parallel shrine to the right of the sanctum. There are two gates to the temple, each leading to the Shiva and Sivakami shrnies. The Sthala Vriksha is margosa which possesses medicinal properties. The temple has two water tanks, one located opposite to the temple and one right to the main gate. The temple has a Kalayana Mahal in front of the Sivakami shrine and the sculpture of Nayak king can be found there. There are paintings from the Nayak period in ceiling of the hall leading to the sanctum.
Worship and religious practices
The temple priests perform the puja during festivals and on a daily basis. Like other Shiva temples of Tamil Nadu, the priests belong to the Shaiva community, a Brahmin sub-caste. The temple rituals are performed six times a day; Ushathkalam at 7 a.m., Kalasanthi at 8:00 a.m., Uchikalam at 10:00 a.m., Sayarakshai at 5:00 p.m., Irandamkalam at 7:00 p.m. and Ardha Jamam at 8:00 p.m. Each ritual comprises four steps: abhisheka, alangaram, naivethanam and deepa aradanai for both Vaidyanathar and Sivakami Amman. The worship is held amidst music with nagaswaram and tavil, religious instructions in the Vedas read by priests and prostration by worshippers in front of the temple mast. There are weekly rituals like somavaram and sukravaram, fortnightly rituals like pradosham and monthly festivals like amavasai, kiruthigai, pournami and sathurthi.The twin festivals celebrated during the full moon days of Tamil month Adi and Thai attract large number of pilgrims from whole of Tamil Nadu.
History
A staunch devotee of lord Siva was living here with his devout wife. She was on the family way and it was time to deliver the child. She sent word to her mother for help. But she did not turn up, hence the lady started herself to the mother’s house. She developed labour pain on the way itself and loudly called the lord for help. The lord immediately appeared before her in the form of her mother herself and helped the delivery of the child. The woman was very Thirsty, the lord just made a line on the earth with his nail and the water sprang up. The lord said that the water would be the medicine for her pain and delivery wound. The lord in the form of her mother disappeared then. The real mother also arrived just then. The girl said that she had delivered the child safely because of her timely help. The mother was very much confused. The lord, with his consort Sivakami appeared before the mother and daughter and told them that he alone nursed her in time of need. The lord also said that as the spring healed her wounds and quenched her thirst, the stream would be known as Kayakudi Aaru. Those having a dip in the river would be free of all fears of life and attain all comforts in life. Some traders procured pepper in Kerala and smuggled it to Madurai telling the authorities that the merchandise was just Dal. They intended to evade the tax payable on pepper. Reaching home, when they opened the bags, they were shocked to find only dal and not pepper. They went to lord Chockanathar in Madurai and apologized for their act. They were advised to pray to Vaidhyanathar. It is said that the message of the story was to teach a lesson to tax evaders. Madavar Valagam is one of the holy places where lord Siva performed his miracles on the first day of the Panguni Tamil month the Says of sun fall on the presiding deity, Vidyanathaswami. Special Poojas are performed to sun on this day.