I'm going to assume you're thinking specifically of the Ichigō offensive in 1944, the last major Japanese offensive against China in the war. Before talking specifically about that though, it's worth pointing out that on past occasions the Japanese had indeed pulled forces from the China theater to help deal with their situation in the Pacific theater. For instance, during the time of the Battle of Guadalcanal, Japan had been preparing the Gōgō offensive in China to capture Chongqing and knock out the Nationalist government for good. But 3 of the elite divisions along with large amounts of war material that were meant to take part in the offensive had to be redirected to help at Guadalcanal, which had taken a turn for the worse for the Japanese, and as a result the Gōgō offensive had to be canceled.
Turning to the Ichigō offensive, its two primary goals were to 1) establish a land connection between Japanese possessions in Korea/Manchuria/North China and in South China/Southeast Asia, and 2) destroy airbases in China that could otherwise be used to conduct raids on the Japanese mainland. The first was desirable because the American airforce and navy had a ever-tightening blockade on Japanese shipping, making it more and more difficult to move around supplies by sea. At this point, the Americans were sinking about 50% of all cargo that the Japanese were sending from Japan and Manchuria to the Pacific theater. The second point was important to the Japanese for a similar reason - denying airbases on land was their most effective way to defend against American air raids, since they could not match the American airforce directly.
Looked at from this perspective, one can see why the Ichigō offensive seemed like a reasonable idea. This was a way for them to use their land forces to help compensate for their inferiority on the sea and in the air in the Pacific theater against the USA. In addition, it's rather unlikely that the bulk of their forces in China could have been reasonably moved out to directly help against the USA anyway, given the rate at which the Americans were sinking Japanese shipping. It should also be noted that at that point many American, Chinese, and Japanese leaders alike still believed that there would be further ground fighting in China trying to push out the Japanese occupiers before the war ended, and so in this sense they would not want to dismiss the China theater yet either.
In the end, the Ichigō offensive actually managed to accomplish its nominal goals too, but it just didn't matter anymore. The Americans had already shifted to using the Mariana Islands (which were easier to supply than bases in China) as airbases to bombard the Japanese mainland. In the aftermath of the offensive, Japanese forces in China had to give up many of their gains to prepare for an American invasion of the Chinese coasts, but the American blockade kept them mostly isolated from Japan proper. The sudden Japanese surrender meant that the China theater was never properly resolved, but this shows how the parts of the Japanese army occupying China were basically stuck there as the Americans drew closer.
Source: The Battle for China: Essays on the Military History of the Sino-Japanese War of 1937-1945 (in particular for this question, the essay "The Strategic Correlation between the Sino-Japanese and Pacific Wars, by Tohmatsu Haruo)