Mao, obsessed with the possibility of a Nuclear attack, made a law on housing policy. When the builder wanted to build new buildings also they had to build large anti atomic shelters where people could live for months, that meant basements had to be fitted out with electricity, plumbing, and sewer pipes. So there was already a ton of livable.
A half-century after their construction began, parts of this underground city in Bejing have been converted into living quarters and until 2010 it was perfectly legal to live in these spaces. People are still living in these places but in recent years some of these have become activity centers where people share convivial moments.
Usually migrant workers, they can't afford private housing and, without the official resident permit known as the "hukou" they have no access to low-cost government housing, so they find themselves living underground.. Estimates suggest there may be more than one million people living underneath the Chinese capital.