Being invited by the Naga King Maniakkitha of Sri Lanka Gautama Buddha made his third visit to Sri Lanka. While he was in Sri Lanka he accepted an invitation made by a regional ruler of the Namunukula massif named Indaka and visited Badulla with five hundred arhat theros, and delivered sermons on Buddhist philosophy. Once Indaka asked for something to worship, Buddha gave him a few of his hairs and sweat which turned to pearls. Indaka then built the dagoba enshrining the relics.
After Indaka built the temple, King Devanam Piya Tissa of Anuradhapura further developed the stupa and turned it to a temple complex. The temple received royal patronage under many other kings of Sri Lanka including Jetta Tissa I, Dutugemunu, Vijayabahu I, and Parakramabahu I. The temple consists of a stupa, image house, statue of deity Indika, statue of Maithri Bodhisattva, and Bo tree. The Bo tree is from a sapling bred from Anuradhapura Jaya Sri Maha Bodhi tree, and the temple is regarded as one of the 32 Buddhist religion sites to have one of the saplings of Jaya Sri Maha Bodhi.
The sacred temple will expect you to wear appropriate clothing when visiting and walk barefooted. It's just a few meters wak from both the railway station and the Badulla main bus station.