The North Korean start the war, China wasn't invovled till the UN and US has push the North Korean to the brink of losing what they have before.
China step in only when the UN and US are at their border and got push back all the way to before thing become stalemate at the DMZ
Back then, Stalin, Mao and Kim all agreed on communism expansion by invading South Korea and Taiwan. It was a matter of priority, who first? Stalin decided on South Korea, the easier target after he was misfed with reports that US military was in Taiwan.
In 1950, CCP sent back 80K Korean ethnic PLA soldiers who fought against KMT in Chinese civil war back to North Korea at Kim's request. By doing so, Mao was an accomplice in the start of the Korean war. Official CCP history has denied they knew about North Korea invasion in advance.