Rent from another landlord mostly. Vienna has close to two million people (give or take some), however only around 500.000 of those live in buildings owned by the city [0]. Those are 1800 buildings by the way, definitely a lot but not unbelievably massive.
Compared to some private companies, such as Vonovia the city of Vienna is just another big player, but by no means massive enough to actually be a monopoly or anything.
It is true that they of course hold a lot of the supply in Vienna itself, housing a quarter of the population, but that still leaves three quarters not living in any of those buildings. It's easy enough to not live in apartments owned by the city if you don't want to.
[0]: www.wienerwohnen.at/wiener-gemeindebau/wiener-gemeindebau-heute.html (Source in German)