Because America is probably the most hostile place to invade, massively outguns China, vastly outranges it. Leaving aside a ground invasion of the U.S. would be horrifically hostile, we don't need good generals to simply sink every single one of their landing ships with a navy five times their size. It'd be suicide. But let's ignore that and compound it, China is entirely economically reliant on the U.S., its exports to us makeup 18% of its -entire economy-. Losing that would cripple it -overnight-. Mind, it'd fucking hurt us too, but in a war situation, we can take that hit for a longer time than they can, as in it would take us at least a couple of months to feel it bad enough to grind us to a halt.
But lets compound this more.
Declaring war on the U.S. and bringing to bare the sheer arms necessary to do so would leave China with fuck and all to defend itself. India and Russia both are hostile parties to China and China to them. Think they'll be nice and quiet?
Declaring war on the U.S. would destroy china in four separate ways. And only one is militarily by us.