They believed the gods have 10,000 rooms. So the Emperor built 9,999 rooms in the palace because he felt he should not out do the gods but not be far off from them either.
He also was so paranoid about being killed that he had a room built with 27 beds in it. Each night he decided which bed to sleep in so he wouldn’t always be sleeping in the same bed.
The Forbidden City was built for the Emperor. They thought he was a descendant of god
It was called The Forbidden City since if a commoner came into it they would be-head them. It was built to protect the Emperor. So there was a large square, then a large wall/gate you had to be let through by guards. Then another large square and another large wall/gate you had to get through. Then another before you got to the actual living quarters.
For almost five hundred years, it served as the home of emperors and their households, as well as the ceremonial and political center of Chinese government.