Kanda Myoujin is a shrine dedicated to Okuninushi no Mikoto, the god who is said to have created the nation of Japan. According to legend, he was once the king of Japan, but was eventually subjugated when asked to hand over the country to the Yamato Imperial Court.
The shrine was originally built by the people in 780 and is located in present-day Tokyo.
In 935, the head of Taira no Masakado, a famous samurai, was buried nearby.
In the 14th century, there was an epidemic in Edo (now Tokyo) and rumors spread that it was due to the lack of proper offerings to Taira no Masakado. When Kanda Myoujin enshrined him as a god, the plague stopped and the shrine became known as a protector of Edo. From then on, everyone from the Tokugawa shoguns to the common people began to participate in festivals held at the shrine.
During the Meiji Restoration, the shrine came under the jurisdiction of the state and the emperor. It was renamed Kanda Shrine and Taira no Masakado was removed from its pantheon.
After World War II, the Emperor issued a declaration of humanity, and people began to petition for Taira no Masakado to be enshrined once again.
In 1948, Taira no Masakado was reinstated as a deity, and the shrine returned to its original name of Kanda Myoujin, although it is still officially known as Kanda Shrine.