On one hand, US clearly benefits by having more demand for its debt (and thus, duh, having the debt being cheaper - finance/economics 101).On the other hand, China is not doing this out of being nice, but of economic necessity.But it still means that one-third of online daters have not yet met up in real life with someone they initially found on an online dating site.
To add to Gramatiks' excellent answer, the question makes another incorrect assumption, that China is somehow doing US a favor by lending money.
Warts and all, US Treasury debt is still among the very safest, least risky investments there are; and the only one at the scale that China as large investor can invest in (what are they going to do, sell US Treasuries and buy Iran Bank notes? It may make some political statement, but very little financial sense).
The fact is, they need to invest the money somewhere, to outpace inflation.
I'm going to omit the more wonky finance arguments pertaining to trade and currency exchanges, but that's also a factor (basically, if you trade in USD, you benefit from investing in USD based of course on exchange rate projections).
The United States would do what any other nation would do: Borrow the money from someone else. The government motivates people to buy these from them by guaranteeing an interest rate.