The Dambulla Rock Temple had first been constructed during the rein of King Vattagamini Abhaya ( 103 BC and 89-77 BC ). The Sinhalese often call him as King Valagamba. During a South Indian invasion the king had to abandon his Anuradhapura Kingdom . For 12 years, King Valagamba was in hiding and had frequented these caves for his safety. After regaining the kingdom of Anuradhapura and becoming the King, to show his gratefulness for his safe place, he converted those caves into Buddhist Temples by constructing walled partitions under the rock overhang which spans the entire area as a single large cave.
He got drip ledges made along this large cave and made it suitable to withstand rainy weather and avoided water seeping inside the caved areas. The three cave temples named as Devarajalena, Maharajalena and the Paccimalena were constructed by him.
After King Vattagamini Abaya's rein, for several centuries this cave temple had not come under the patronage of any other Kings until Vijayabahu I (1055-1110 AD ), who made Polonnaruwa his kingdom. He had done renovations to the Cave temples and it is believed that there were Buddhist monks dwelling in this and nearby caves at that times. King Keerthi Sri Nissankamalla (1187-1196 AD ) was much involved in uplifting the place with many additional Buddha images being constructed and gold plating some seventy three Buddha images in the cave temple.
King Buwanekabahu (1372-1408 AD), King Vickramabahu III (1360-1374 AD), King Rajasinha I (1581-1591 AD) and King Vimaladharmasuriya I (1592-1604 AD ) are the other Kings merited with the uplifting of the status of the Temple at various times of the years gone by.Another interesting fact is that the Archeologists state that this cave and other numerous caves around the main rock had been in use for dwelling in pre historic times too from the evidence found so far.