Germany does have a giant, excellent chemistry industry.
> China's interest in batteries is not a recent trend. It has been investing in their production for many, many years. It has been attempting to dominate not just the production of cells but also of the cathodes and anodes that go inside them - not to mention the chemicals used to make those electrodes. It has been firming up the entire supply chain - all the way down to the mines. And while you can find only so much lithium and cobalt in China, Chinese firms have been buying up mines in Africa and elsewhere for years.
The fun thing is that the west saw it coming and didn't try particularly hard to forestall it. Consistent, long term industrial policy is very effective.