Read the story
The boy who would become Emperor Meiji was born in 1852 just outside these walls, in a small house at the north end of the Gosho. Births were considered polluting, so not even an heir could arrive inside. He would grow up inside, then leave for good.
The place he grew up in had deep roots. In 794, Emperor Kanmu founded Heian-kyo, a grid city modeled on the Chinese capital of Chang'an. The first palace stood a short distance to the west; fire destroyed it in 1227, and it was never rebuilt. The court eventually settled here, on the site of an old Fujiwara mansion. Fires kept coming, and the halls you see were completed in 1855, their grandest ceremonial buildings recreated in Heian style from the research of a court scholar named Uramatsu Kozen.
At about fourteen, the boy, Mutsuhito, became emperor when his father died. He rarely left the grounds; a trip to Osaka in the spring of 1868 was his first time outside the imperial precincts since early childhood. That same year, in the great Shishinden hall, the Charter Oath was proclaimed. Edo was renamed Tokyo, the "Eastern Capital." The young emperor traveled there, came back, and in 1869 went again. He never returned to live in Kyoto.
Here is the curious part. No edict ever announced that the capital had moved. Officials chose a word meaning "establishing" a capital, not "relocating" one. No law in force today names Tokyo as the capital, and some in Kyoto will tell you their city never stopped being one.
The palace didn't simply go dark. Meiji ordered it preserved in 1877, and Emperors Taisho and Showa were both enthroned here. And every May 15, about six hundred people in Heian court dress process out through the Kenreimon gate for the Aoi Matsuri, as if the emperor had only stepped away.