The Imperial Garden of the Forbidden City is in the northernmost direction of the central part of the Forbidden City, behind the Kunning Palace. It was built in the Ming Dynasty and was called the Royal Garden in the Qing Dynasty. The main function of the royal garden is for the emperor and his concubines to rest and play. In addition, there are places to worship and rest, as well as reading and book collection. The layout of the imperial garden is also symmetrical, with many pines and cypresses dotted between rockeries, forming a scene of evergreen all the year round.
But there were no trees in other parts of the palace, not because ancient people didn't know how to green, but for safety first. Because many building materials were made of wood at that time, they wouldn't plant trees outside for fear of fire. Also, considering the majesty of the royal family, the whole building is very magnificent. If you add trees, you will lose your sense of domineering.
The most important point is that in ancient times, imperial power was supreme. If the trees were planted in the former dynasty, people were worried that someone would hide in the trees and assassinate the emperor. If the trees were planted, soldiers would patrol and block the line of sight. So in addition to the imperial garden, other places are deliberately not planting trees.