In the 4th century CE, King Guhasiva of Kalinga was in possession of a sacred relic, a tooth of Buddha. The cause of political upheaval for hundreds of years, the tooth was believed to impart a divine right to rule, to whoever possessed it. The King, fearing that the object of his Buddhist worship would be forcibly taken from him, secretly sent the tooth away with the Princess Hemamali and her husband, Prince Danthakumara. Disguised as Brahmins and hiding the tooth in Princess Hemamali's hair, legend states that they sailed to Sri Lanka. Accounts of where they landed in Sri Lanka vary, with some recording their port as Trincomalee and others as Welitota or present-day Balapitiya.
The legend that they landed in Balapitiya, at the mouth of the Maduganga estuary, is recorded in Pali Dalada Vansaya, or Chronicle of the Tooth Relic. The story continues that the couple hid the tooth in a sand shelter at Kothduwa, while tarrying there, before finally giving it to King Sirimeghavanna, the ruler of Sri Lanka at the time. Many centuries later, after Kothduwa had become separated from the mainland and overgrown with vegetation, it was re-discovered by Deva Pathiraja, a minister to King Parâkkamabahu IV, who reigned in the 14th century. The Minister planted there on the island one of the 32 sacred buds of Jaya Sri Maha Bodhi. During the tumultuous 16th century, when the Sitawaka and Kotte kingdoms vied for power and the Portuguese threatened the shores of Sri Lanka, it is said that the hot-headed prince Veediya Bandara was keeper of the tooth relic, and that he returned it for safe keeping to Kothduwa, where it remained for a short period of time. Again, the island and the Dethis Maha Bodhi planted there passed into neglect, until businessman Samson Rajapakse took an interest in the area in the 1860s. He had the present temple built around the Bodhi tree. A portrait of Rajapakse now hangs in the main hall of the temple complex