The name "Ganapatishvara", which also gives the town his alternate name "Ganapatishvaram", denotes Shiva as "Lord of Ganesha" and alludes to the legend that Ganesha killed a demon called Gajamukhasura and then worshipped his father Shiva here.
[1][2][3] According to another legend, a king ruling Rameswaram region prayed to Lord Shiva for child boon and performed a yajna.
As per oral tradition, the icon of Vatapi Ganapati was brought booty from the Chalukyan capital of Vatapi (presently known as Badami in northern Karnataka) by Paranjothi, the commander-in-chief of the Pallava king Narasimhavarman I (reign: 630–668 CE), following the conquest of Pallavas over the Chalukyas (642 CE).
Later, Paranjothi renounced his violent ways and became a Shaiva monk known as Siruthondar,[5] is venerated as a Nayanar saint today.
[2][3] However, no written records substantiate the oral tradition; the Ganesha icon is missing from list of war booty brought by the Pallava general.