The temple is associated with a sage called Herandar, who, according to legend, is believed to have gone through an underground passage to the nether world and brought the Kaveri River to the earth to flow into the Bay of Bengal.
Since the river took a convoluted direction in its flow, the place is called Tiruvalanjuzhi. There is an image of Herandar in the temple and the trunk of the elephant-headed god, Ganesha (Vinayagar) swirls towards the right
The presence of Buddhist images from the Chola period in the temple show influence of Buddhist tradition in the region.
The temple is renowned for its shrine dedicated to Ganesha (Vinayagar, Vinayaka). The idol of Vinayaka is white in colour and is believed to have been created out of sea foam (kadal norai). Hence, the temple is also known as Swetha Vinayagar Temple in Sanskrit or Vellai Vinayakar Temple in Tamil, meaning "the temple of the white Vinayaka".

According to popular legend, Indra, the king of the Devas created the idol of Ganesha out of sea foam during the churning of the ocean and left it in a niche in the temple hoping to get back the idol sometime later.
But later, when he returned to remove the idol of Ganesha, it would not budge. So, the idol was allowed to remain where it was. A lattice-worked stone window pane called palahani is present in the temple.The temple is originally believed to have been built by Kanaka Chola in prehistoric times.
As per another legend, when Devas (celestial deities) and Asuras (demons) were churning the Ocean of milk with Vasuki the serpent, they disregarded the advice of Vinayaka. It resulted in the spilling of poison in Amruta.
To propitiate, the Devas created an image of Vinayaga with sea foam and worshipped him at the place. The image of the presiding deity is white in colour on account of the belief.
The temple priests do not conduct abhishekham and pour any liquids over the deity for this reason.
Image of Swetha Vinayagar shrineThe central temple, according to historian Subramanyan, is an early Chola temple as seen from the inscription (ARE 620 of 1902) made during the reign of Rajaraja I (985–1014 CE) indicating grants made during the 38th regnal year of Madiraikonda Parakesarivarman. One another inscription on the south wall of the mandapa in front of the sanctum dated to Rajaraja indicates grant of land on the 21st year of the rule of Parakesarivarman.
An inscription (ARE 633 of 1902) during the 25th regnal year of Rajaraja indicates gift of gold to the deity by Kundavai, the daughter of the king. Another inscription dated to the 258th day during the 24th regnal year of Rajaraja on the south wall of the hall indicates tax free land to the service of two deities, namely, Kshetrapalar and Ganapatiyar.

Intricate sculptures on the temple walls
The inscription on the north wall of the hall (ARE 633-B of 1902) dated to the third regnal year of Rajendra I (1012–1044 CE) indicates that he ceremonially passed through a hill of gingely seeds and gifted twelve gold flowers to the feet of Lord.
The same inscription indicates gold flowers gifted by his queen Valavan Mahadeviar. Another inscription from the northern wall of Bhairavar shrine during the third regnal year of Rajendra I indicates gift of two gold flowers to the deity by Danti Sakti Vitanki while he was performing Tulabhara at Thiruvisanallur. An inscription from the 11th regnal year of Rajaraja III (1216–1256 CE) indicate that the shrine of Vanduvarkuzhali Amman might have possibly been installed during his reign.