Updated: Dec 9, 2022
The idol of the Srirangam Temple first appeared from the milky ocean, in front of Brahma, who worshipped it for a long time. He then passed it on Surya, the sun god to continue worshipping as per the traditions. The idol yet again changed hands, and was passed down generations from Surya to Ikshvaku and finally to Rama. The idol was consecrated at Ayodhya.
After the Ramayana war, Rama gifted it to Vibhishana as appreciation for helping him in the war. Vibhishan was overjoyed and planned to carry it to Lanka to consecrate it there. On his way back, he reached near Trichy at twilight, in time for his evening ablutions. He placed the idol on the ground and went away to complete the daily rituals. When he came back, he realised he couldn't pick it back up. God Ranganatha, then appeared before him and told him of his desire to stay put there. He further also promised to lie in his resting pose facing the south, to bless Lanka. Kind Dharma Varma, of the Chola dynasty and an avid worshipper of Vishnu, then built a temple for the idol. This temple was destroyed in the floods of the Kaveri river, and another king of the same dynasty, King Kilivalavan rebuilt it as it stands today.