China, through the PBOC, controls the amount of yuan circulating in the market.
When Chinese manufacturers sell goods to the US, they are paid in US dollars.
But Chinese manufacturers can't pay their workers and expenses in US dollars...since they're in China...which means they now need to SELL their newly acquired dollars and BUY yuan.
Doing this would would strengthen yuan though (due to higher demand) which China doesn't want because their exports would become more expensive.
More expensive exports would mean being less competitive in the global markets. Which would mean less export sales. Which would mean massive job losses. Which would eventually mean social unrest. Then maybe riots and crazy mayhem.
So what do they do?
The PBOC buys the dollars from them and gives them yuan.
Where does PBOC come up with the yuan to buy the dollars from the manufacturers?
Using central bank magic. They simply type it into existence with keystrokes.
This artificially keeps the yuan weak. Which benefits exporting companies.
Now the PBOC doesn't like holding a boatload of cash, it generates no yield, so it needs to "park" it somewhere safe....so they use the dollars to buy US government bonds.