The temple was built by Emperor Lý Thái Tông, who ruled from 1028 to 1054. According to the court records, Lý Thái Tông was childless and dreamt that he met the bodhisattva Avalokiteshvara, who handed him a baby son while seated on a lotus flower. Lý Thái Tông then married a peasant girl that he had met and she bore him a son.
The emperor constructed the temple in gratitude for this in 1049, having been told by a monk named Thiền Tuệ to build the temple, by erecting a pillar in the middle of a lotus pond, similar to the one he saw in the dream.
The temple was located in what was then the Tây Cấm Garden in Thạch Bảo, Vĩnh Thuận district in the capital Thăng Long (now known as Hanoi). Before the pagoda was opened, prayers were held for the longevity of the monarch. During the Lý Dynasty era, the temple was the site of an annual royal ceremony on the occasion of Vesak, the birthday of Gautama Buddha. A Buddha-bathing ceremony was held annually by the monarch, and it attracted monks and laymen alike to the ceremony. The monarch would then free a bird, which was followed by the people.
According to VietKings (Kyluc.vn)