The general the idea is that even if new housing isn't affordable, the existence of more housing overall lowers demand on older housing and therefore lowers prices. If you can encourage enough production of even luxury apartments, this forces the older apartments to lower rent as people capable of paying the old prices move to new locations. If enough houses are built, eventually you drive the price of the lower tiers of housing down far enough for the poor to afford (or at least the government to more easily fund access to.) Unfortunately, this is not a problem that can be solved quickly. The problem took us decades of under building new housing to get to, so it's not surprising it will take us time to get out of it either.
One big caveat here is it requires people to actually live in the housing. If real estate is being bought and sat on as a speculation tool (or used as something like an air B&B instead of a rental), it won't actually meet the demand for habitation. As such, some sort of regulation is needed to ensure that housing is actually either lived in or rented out.
Second issue is that, of course, NIMBYism is at least as big a threat if not more as price regulation. If things aren't allowed to be built due to local authorization either being impossible or the approval process taking ages to complete, requiring affordable housing be included is the least of your worries. Getting into the many flavors of NIMBY would indeed be too big a topic for this thread, but the overall effect on housing creation is definitely awful.
Edit: As a note, there is a massive incentive for those who currently own property to not want housing to be affordable. Lack of supply drives the prices way up, and the people who have seen the worth of their housing double in the last decade don't want prices to go back down to a reasonable level. Since homeowners generally make up a sizeable portion of voters in a given area...it's not too surprising that people constantly vote in ways that make building harder, no matter how hard that makes life for the next generation.