Germany will launch a large-scale war, but some important resources (such as iron, copper, tungsten, etc. ) are scarce in China, while these resources are abundant in southern China. So Germany imported a lot of strategic materials from China.
At that time, China was being invaded by Japanese fascists, and it also needed oxygen to import a large number of advanced weapons and equipment from Germany to resist Japan. So the two countries began to cooperate closely for their own purposes.
In order to face the anti-fascist alliance together, Japan and Germany were allies during World War II.