First of all, we must note that it is impossible to answer a question like this with complete certainty. It is never 100% clear what causes human events to occur as they do. We can conjecture, but we cannot know for sure.
The most likely answer for this has two parts. First, China was more successful in modernizing its economy and making its people wealthier. Second, China was more careful about limiting the amount of political freedom that it allowed its people.
One of the main problems that the Soviet Union faced was a lack of economic development. Its people became tired of a lack of material goods and became rebellious. China did better than the Soviet Union in this regard. It began to open up its economy under the leadership of Deng Xiaoping. When it did so, living conditions began to improve. This kept its people more contented than the Russian people were.
At the same time, China was much more cautious than the Soviets were. Gorbachev tried to implement both political glasnost and economic perestroika at the same time. The Chinese did not try this. Instead, they opened their economy but kept their political system under tight wraps, as can be seen in the 1989 Tiananmen Square episode.
The Soviet Union tried to open both its economy and its political system. By contrast, the Chinese worked on improving their economy and kept their political system tightly controlled so that no serious dissent can work to take power away from their communist party.