Tenryū-ji (天龍寺), formally known as Tenryū Shiseizen-ji (天龍資聖禅寺), is the head temple of the Tenryū-ji branch of the Rinzai sect of Zen Buddhism, located in Susukinobaba-chō, Ukyō Ward, Kyoto, Japan. The temple was founded by Ashikaga Takauji in 1339, primarily to venerate Gautama Buddha, and its first chief priest was Musō Soseki. Construction was completed in 1345. As a temple related to both the Ashikaga family and Emperor Go-Daigo, the temple is held in high esteem, and is ranked number one among Kyoto's so-called Five Mountains. In 1994, it was registered as a UNESCO World Heritage Site, as part of the "Historic Monuments of Ancient Kyoto".
In the early Heian period, Empress Tachibana no Kachiko, wife of Emperor Saga, founded a temple called Danrin-ji on the site of present-day Tenryū-ji. The temple fell into disrepair over the next four hundred years.
In the mid-thirteenth century, Emperor Go-Saga and his son Emperor Kameyama turned the area into an imperial villa which they called "Kameyama Detached Palace" (亀山殿, Kameyama-dono). The name "Kameyama", which literally means "turtle mountain", was selected due to the shape of Mt. Ogura, which lies to the west of Tenryū-ji—it is said to be similar to the shape of a turtle's shell. All Japanese temples constructed after the Nara period have a sangō, a mountain name used as an honorary prefix. Tenryū-ji's sangō, Reigizan (霊亀山, "mountain of the spirit turtle"), was also selected due to the shape of Mt. Ogura.
The palace was converted into a temple in the middle of the Muromachi period at the behest of Ashikaga Takauji, who wished to use the temple to hold a memorial service for Emperor Go-Daigo. Ashikaga became the shōgun in 1338, and Go-Daigo died in Yoshino the following year. Ashikaga opposed the failed Kenmu Restoration, which was started by Emperor Go-Daigo, and the emperor decreed that Ashikaga be hunted down and executed. When his former-friend-turned-enemy died, Ashikaga recommended that Zen monk Musō Soseki construct a temple for his memorial service. It is said that the temple was originally going to be named Ryakuō Shiseizen-ji (暦応資聖禅寺), Ryakuō being the name of the reign of the emperor of the northern court at that time. However, Ashikaga Takauji's younger brother, Tadayoshi supposedly had a dream about a golden dragon flitting about the Ōi River (also known as the Hozu River), which lies south of the temple, and the temple was instead named Tenryū Shiseizen-ji—the term "Tenryū" literally means "dragon of the sky". In order to raise the funds to build the temple, two trading vessels called Tenryūji-bune were launched in 1342. A ceremony was held on the seventh anniversary of Emperor Daigo II's death in 1345, which functioned as both a celebration of the completion of the temple, and as Daigo's memorial.
During the 1430s, the temple entered into a tributary relationship with the Imperial Court of Ming-dynasty China. Chinese imperial policy at the time forbade formal trade outside of the Sinocentric world order, and both the Japanese imperial court and Ashikaga shogunate refused to submit to Chinese suzerainty. This arrangement with the Tenryū-ji allowed for formal trade to be undertaken between the two countries, in exchange for China's control over the succession of chief abbot of the temple. This arrangement gave the Zen sect, and Tenryū-ji more specifically, a near monopoly on Japan's legitimate trade with China. In conjunction with the temple of the same name in Okinawa, as well as other Zen temples there, Tenryū-ji priests and monks played major roles in coordinating the China–Okinawa–Japan trade through to the 19th century.
The temple prospered as the most important Rinzai temple in Kyoto, and the temple grounds grew to roughly 330,000 square meters (33 hectares; 82 acres) in size, extending all the way to present-day Katabira-no-Tsuji station on the Keifuku Railway. At one time, the massive grounds were said to contain some 150 sub-temples, however, the temple was plagued with numerous fires, and all of the original buildings have been destroyed. During the Middle Ages, the temple met with fire six times: in 1358, 1367, 1373, 1380, 1447 and 1467. The temple was destroyed again during the Ōnin War and subsequently rebuilt, but in 1815 it was lost to yet another fire. The temple was severely damaged during the Kinmon Incident of 1864, and most of the buildings as they stand today are reconstructions from the latter half of the Meiji period. The garden to the west of the abbey, created by Musō Soseki, shows only traces of its original design.
On the eastern boundary of the temple grounds lie two gates: Chokushi Gate (勅使門, chokushimon) and Middle Gate (中門, chūmon), from which the path to the temple itself leads west. Generally, Zen temple grounds are designed so that they face the south, with major buildings aligned along the north-south axis. Tenryū-ji's layout is an exception to this principle. Sub-temples line both sides of the path, which leads to the lecture hall. There are numerous buildings behind the lecture hall, such as large abbey (大方丈, ōhōjō), the small abbey (小方丈, kohōjō), the kitchen, the meditation hall, and Tahō-den (多宝殿) hall, however, each of these is modern reconstruction.