Because Communism failed in China before it did anywhere else.

Great leap forward, 20–100 million dead
Communism failed China so badly it was as relevant to the world stage as perhaps Pakistan is today: a nuisance for the neighbors perhaps, but not more. Yet China wanted more, it wanted to become the leader of the Communist world.
When it became clear the Soviets would have none of that they had to make a choice: either accept Soviet dominance and submit to the Russian Communist Party, or open up with the USA and change.
They did the sensible thing.

Nixon in China
China remained nominally Communist but in practice they’ve been anything but since 1970s. Their system right now most resembles that of 1920s Italy or 1930s Germany, which is many things, but even ardent anti-Communists would agree it is not Communism.
A famous political joke goes as such:
The American came to two roads that lead to 2 places. One sign reads “communism”, and the other one read “capitalism”, and went straight to “capitalism”.
Stalin came around, and went straight to “Communism”.
Then Chairman Deng came around, switched the signs, and went towards the one that read “Communism”.
The truth about The Market, is that neither totally free or totally controlled market would ever work. The U.S.S.R. and the U.S. have proven that. Completely free markets result in Social Darwinism: the rich get richer, and the poor get poorer.
Completely controlled markets lead to the opposite of control: complete hunger and lower life standards. China took the road down the middle. It’s hard, for anybody, or China, in this case. Economics has never been easy.
China is currently carefully balancing between “control” and “free market”. A slight lean towards one side may cause a lot of problems.