Question: why was the nijo castle built?
Answer: Nijo Castle (二条城, Nijōjō) was built in 1603 as the Kyoto residence of Tokugawa Ieyasu, the first shogun of the Edo Period (1603-1867). ... After the Tokugawa Shogunate fell in 1867, Nijo Castle was used as an imperial palace for a while before being donated to the city and opened up to the public as a historic site.