OP: I am very sorry this happened to you. UA seems to have made a number of mistakes. For most of us here on FT who travel a lot, we forgot that infrequent travellers can be quite lost on international journeys, especially if transiting an unfamiliar airport.
You can stay in certain major Chinese cities without a visa for up to 72 hours when you are IN TRANSIT to a third country. You cannot just visit for 72 hours, even as a business trip.
But, that doesn't apply here since they were transiting. Actually, it should be "especially as a business trip" since Chinese visas for business are even more complicated (I lived in China for a number of years and go back once/twice a year now on business).
BTW, OP may be a female (OP says "and my boyfriend"). UA was totally wrong here. The only thing I would have done differently would have been to try to travel to SFO where the UA staff would, most likely, know the rules better. I don't know why UA would not have re-routed on their own flights once they admitted a mistake on their part. Also, BTW, I don't have a smart phone (my old flip phone is furnished by the government - your tax money at work
).