China did not react when the war situation was in favor of North Korean forces.
However, as the North Korean forces lost power in the Incheon Landing Operation and the UN and South Korean forces advanced to the 38th parallel, China started to show its intention to intervene in the war.
The UN forces thought that China would not intervene in the war, but they were proven wrong as China had already intervened in the war and sent a large number of troops to the war.
According to China, they decided to intervene in the war as they accepted North Korea's request for military aid and they wanted to gain political and social stability by obtaining aid from the Soviet Union to strengthen their military and economy.
They also believed that if the US occupied North Korea, they might suffer disadvantages as they would face a hostile country across the border.