IIRC there was a government backed push to get people to play ping-pong in order to show that Chinese people could excel at sports. Presumably it was chosen because it is a sport that people with the average Chinese build would excel at.
The space thing is surely also a factor. Any given urban stadium on any given evening may well have a few hundred people out walking in it. It can be very difficult to find space for casual footbal games.
Besides ping-pong, badminton and basketball are also quite popular. Both these sports can also be played in relatively small spaces.