Until 11th century, Ryali was a wild forest and was under the rule of Chola Kings. The construction of the temple has an interesting tale behind it. It so happened that Sri Raja Vikrama Deva of Chola dynasty, came to this place for hunting and having been tired, took shelter under a Ponna tree. It was then that Lord Vishnu appeared in his dream and informed him that an idol of Him was lying in some place, unattended. It was not being worshipped. The Lord also gave him the clue to find the idol, asking him to drag a wooden chariot in that place and dig the spot where a nail from the chariot would fall.
King Vikrama Deva suddenly woke up from his sleep, wondering what his dream meant. He then did accordingly and dug the spot where the nail from the chariot he pulled, fell. To everyone's astonishment, the king's dream came true and an idol of the Lord was found. The King then installed the idol in that place and even constructed the temple.