Three main factors drove the Chinese decision to engage in the Korean War: security concerns, the need to consolidate CCP’s regime and domestic control, and the ideologies possessed by the individual leaders.
http://www.inquiriesjournal.com/articles/1069/explaining-chinas-intervention-in-the-korean-war-in-1950