By the late 60s it was clear the PRC was slowly aligning itself with the west against the Soviet Bloc. Mao was also increasingly fearful of the Soviets after the 1968 Prague Spring.
Meanwhile North Vietnam was receiving aid from both rival Communist powers. It was officially friendly with both, but increasingly leaned to the Soviets when the PRC shifted to the west. The Khmer branch of the Indochinese Communist Party (which was dominated by the Vietnamese) then split and formed the Khmer Rouge with Chinese backing. The rest is history.
Henry Kissinger revealed in his latest book that in 1979, China invaded Vietnam without any intention to overthrow the Vietnamese government, but hoped to embarrass the Soviets into failing to back its ally and to further strengthen the relations with the west. Deng in fact had visited several Burma, Thailand, Malaysia, Singapore, Japan, and the US to gain support for his adventure. Kissinger even hints that Brezhnev's failure to support the Vietnamese made him turn his sights on Afghanistan to compensate the Chinese insult to Soviet power.
Kissinger wrote that Deng told him that Vietnam was planning to go Pac-Man on all of Southeast Asia, and that China was its only impediment. That sounds plausible but a bit hard to believe.