According to the ancient historical record known as the Nihon Shoki, the festival originated during the reign of Emperor Kinmei (reigned CE 539 - 571). The ancient records known as the Honchō getsurei and Nenchūgyōji hissho reveal that a succession of disastrous rains with high winds ruined the grain crops, and epidemics had spread through the country. Because diviners placed the cause on divine punishment by the Kamo deities, the Emperor sent his messenger with a retinue to the shrine to conduct various acts to appease the deities, in prayer for a bountiful harvest. These included riding a galloping horse.
This became an annual ritual, and the galloping horse performance developed into an equestrian archery performance. According to the historical record known as the Zoku Nihongi, so many people had come to view this equestrian performance on the festival day in the 2nd year of the reign of Emperor Mommu (r. 697-707) that the event was banned.
In the ninth century, Emperor Kanmu established the seat of the imperial throne in Kyoto. This represented the beginning of the Heian Period in Japanese history. Emperor Kanmu recognized the deities of the Kamo shrines as protectors of the Heian capital, and established the Aoi Matsuri as an annual imperial event.
The festival saw its peak of grandeur in the middle of the Heian Period, but this waned in the Kamakura Period and the following Muromachi Period, and as the nation entered the Sengoku Period, the festival procession was discontinued. In the Genroku era (1688–1704)
The festival has been called Aoi festival for the hollyhock leaves used as decoration throughout the celebration. These leaves were once believed to protect against natural disasters.