China is doing this for energy independence. Their fossil fuel supply chain is critically vulnerable. They don't care about the climate, but will happily play the optics.
The US is an energy exporter (and its energy imports are mostly hydro and oil from Canada which is a pretty safe trade route). China is a massive importer and they import from countries they aren't especially friendly with