The Baikamujinzō tells us that this Tenman-Gū was founded on June 25, 1478 by Ōta Dōkan on a site inside Edo Castle. Ōta is said to have had a vision of Sugiwara Michizane and built it to both enshrine the Kami of Learning and to act as a guardian for the castle. However, once the Tokugawas came into power the castle was greatly expanded, and In 1607 the second Shōgun, Hidetada, had the shrine moved to an area outside the castle called Kaiduka (貝塚), and he also had the name of the area changed to the one it still bears, Hirakawa-chō. According to the shrine's notice board, all three branches of the Tokugawa clan worshipped there, and at the New Year
(Note: numbers in parentheses after kami names
From Merged Shrines
Tokugawa Ieyasu 徳川家康公
Hirakawa Inari Jinja
Greeting ceremony the shrine was granted the high honour of its chief priest being given an audience by the Shōgun. Scholars were attracted to the shrine—how could they not be when the enshrined Kami was that of learning?—and anecdotes are still told of academically eminent believers such as the blind Hanawa Hokiichi and Takano Chōei, a master of Dutch learning. Until the Meiji Restoration, when it was given village shrine status in 1872, its bettoji was a branch of the Ueno Kanei-ji.
The shrine's location—the nearest to the Imperial Palace, as the crow flies under 400m to the Outer Moat—it attracted many people but suffered fire damage on at least ten occasions in the Edo Period before being badly damaged by the Great Kantō Earthquake and essentially being razed to the ground in the 1945 firebombing. It was not until 1969 that the main hall was fully restored. The following year some land was sold to a condominium developer and the funds thus acquired made possible the restoration of the hall of offerings/prayer hall and various other installations. This work was completed in 1973.
A one minute walk from the #1 exit of Hanzomon Station. One structure in the grounds which did escape the serial calamities described above is the bronze torii erected in 1844. the oldest torii in Chiyoda-ku, it was cast by Fujiwara Masatoki, the 8th generation master of the Nishimura Izumi school of metal casters. and has been designated as a tangible folk cultural asset by Chiyoda-ku. The pair of komainu in front of the main hall have been similarly designated. These were first put up in 1801 but were damaged shortly thereafter and after being repaired were re-erected in 1852. Finally, as befitting a shrine dedicated to Sugawara Michizane this Tenman-Gū has nade-ushi, five of them in fact. Looking at the in-ground shrines the Inari one stands alone, while the other three share the same hall, the Sandengū (三殿宮).