Legend has it that Rama installed the lingam here to atone for the sin of killing Ravana, who was a brahmin by birth but a demon by nature. He selected this beautiful valley surrounded by hills and verdant greenery for the purpose and ordered Hanuman to bring a lingam from Varanasi, believed to be Shiva's favourite place.
Hanuman was late in arriving with the lingam and as the auspicious hour was nearing, Shiva himself, appeared before Rama and presented a lingam to him for installation. Hence the lingam in the temple is called a Swayambhu Linga. It is also called Ramalingeswara as Rama had installed the lingam.
Hanuman returned with 101 lingams for selection from Varanasi and felt aggrieved at not having his lingam installed. Hence he threw them all over the area. Even to this day several lingams are found scattered all over the place outside the temple. These lingams are worshipped along with the lingam in the sanctum of the temple to this day.
To pacify Hanuman, Rama ordained that precedence would be given to him for worship at the temple. He also said that the hillock where the lingam was installed would bear his name Kesarigiri that is, Hanuman, the son of Kesari. Over a period of time, it has colloquially transformed and is now known as Keesara and the hill as Keesaragutta. Ever since, the rituals follow the command of Rama.