Borobudur was likely founded around 800 AD, built by an architect, named is Gunadharma. Little is known about this architect. His name is actually recounted from Javanese legendary folk tales rather than written in old inscriptions. He was said to be one who "... bears the measuring rod, knows division and thinks himself composed of parts.
This corresponds to the period between 760–830 AD, the peak of the Sailendra dynasty in central Java, when it was under the influence of the Srivijayan Empire. The construction has been estimated to have taken 75 years and been completed during the reign of Samaratungga in 825.
There is confusion between Hindu and Buddhist rulers in Java around that time. The Sailendras were known as ardent followers of Lord Buddha, though stone inscriptions found at Sojomerto suggest they may have been Hindus.[18] It was during this time that many Hindu and Buddhist monuments were built on the plains and mountain around the Kedu Plain. The Buddhist monuments, including Borobudur, were erected around the same time as the Hindu Shiva Prambanan temple compound. In 732 AD, the Shivaite King Sanjaya commissioned a Shivalinga sanctuary to be built on the Ukir hill, only 10 km (6.2 miles) east of Borobudur.
Construction of Buddhist temples, including Borobudur, at that time was possible because Sanjaya's immediate successor, Rakai Panangkaran, granted his permission to the Buddhist followers to build such temples. In fact, to show his respect, Panangkaran gave the village of Kalasan to the Buddhist community, as is written in the Kalasan Charter dated 778 AD. This has led some archaeologists to believe that there was never serious conflict concerning religion in Java as it was possible for a Hindu king to patronize the establishment of a Buddhist monument; or for a Buddhist king to act likewise.
However, it is likely that there were two rival royal dynasties in Java at the time—the Buddhist Sailendra and the Saivite Sanjaya—in which the latter triumphed over their rival in the 856 battle on the Ratubaka plateau. This confusion also exists regarding the Lara Jonggrang temple at the Prambanan complex, which was believed that it was erected by the victor Rakai Pikatan as the Sanjaya dynasty's reply to Borobudur, but others suggest that there was a climate of peaceful coexistence where Sailendra involvement exists in Roro Jonggrang