China produces more than it consumes and ships the excess to the US. This keeps its economy roaring, but we don't send them back other goods or services. Instead we send them US debt. The Chinese value this sufficiently that they stay in a productive mood and keep on producing, and their economy keeps growing. It's sort of like inflation except that instead of everyone in China having more and more printed Chinese mo…
The entire phenomenon can be thought of as the USA exporting inflation to China.
On a smaller scale, this is actually a good idea. It's known as building a foreign currency reserve. It serves as buffer against inflation. If the Renminbi were to spiral out of control, they could adjust the peg, give US dollars back to the people in exchange for large quantities of Renminbi, and just retire the money. People would keep their holdings denominated in the dollar until things settled down with Renminbi. Every country has foreign currency reserves. In fact, with a stable foreign currency, building a foreign currency reserve is the safest way to inject money into an economy.
Generally, it is thought that Chinese holdings of American debt are far larger than necessary for an effective foreign currency reserve.