The other answers are a bit outdated so I share the latest information. You can purchase in airports a 4G/LTE SIM card, not 3G. Either China Mobile or China Unicom is considered better than China Telecom.
However, the price might be a bit expensive in the airport; I have purchased it only at Shanghai Pudong International Airport but Beijing's would be likely similar.
Alternatively you can purchase it in the city, but it might not be a good option if you don't understand Chinese language. I recommend to buy it in the airport if you want to ensure that you have a mobile connection.
As to the free Wi-Fi, many of them require an SMS verification and it mostly only accepts Chinese phone number. Wi-Fi at most privately owned cafes and restaurants don't have this troublesome steps (but don't go to Starbucks; it requires a phone verification).