The legend says that the temple of Ranganathaswamy was built on the same spot where a Chola king found an idol of Ranganathan while chasing a parrot in a forest in the outskirts of Trichy.
The idol of Ranganathan was a present from Lord Rama, an avatar of Vishnu, to King Vibhishana. The king was told not to put the idol on the ground, or he would not be able to move it again. When the king wanted to take a bath in Srirangam, he gave the idol to Lord Vinayaka, who accidentally laid it on the sand on the banks of the Kaveri.