Research and development of new technologies often is a "rising tides lifts all ships"-type deal, which it is absolutely in the government's best interest to support.
For China, the best case scenario would of course be to control a locked-down best-in-class frontier model that the rest of the world becomes reliant on. The US seems to be beating them at that, and "Everyone is reliant on the United States" is a pretty bad scenario. A middle ground, positive outcome is that no one is reliant on locked-down closed models, so they're supporting that outcome.
It's really not that nefarious.
We only think "government spending is for hippies" in the US, and only when we don't look at public spending like defense bills.