First, China does get terror attacks, though not that many. (Although to be fair, the United States doesn’t get that many either. Our random violence doesn’t tend to be terror so much as fame seeking white men with various mental problems. China gets those attacks as well, but their gun control laws tend to limit the damage.)
Second, China has stamped on terrorism with tools that are unavailable and undesirable in the West. The Great Firewall for one has limited the ability of radicals to recruit and communicate with new members. They also have a heavy surveillance state where people assume that they are being monitored at all times. Facial recognition software is used to track all movements for anything suspicious. They have essentially banned any public expression of Islam to the point where they do random cell phone checks to see if you have any religious material on the phone. Mosques are basically completely under surveillance at all times and no public official is allowed to enter a mosque for religious purposes. All children under the age of 18 are not allowed in any mosques. Beards and veils have been outlawed as well. There are even reports that they are running ‘drinking and smoking’ campaigns to encourage the behavior knowing that those who don’t are more likely to be more religious and these people get sent away. They also do not allow freedom of movement for Muslims so they basically are contained completely within Xinjiang. One of their more interesting methods is called grid policing. There is a police station in every ‘grid’ of 500 people. The officers there are responsible for monitoring the 500 people within their grid at all times. They are also given quotas for finding ‘extremists.’ so even people who aren’t particularly extreme at all get swept up in quota policing and sent to reeducation facilities. Fun times.
Speaking of ‘reeducation tactics.’ There are 11 million or so Uighurs in Xinjiang. Of those, 1 million are in ‘reeducation camps’ which are basically good old fashioned brain-washing facilities. People in these camps are sometimes just picked at random so they can later be released as good little Communists and be used to spy on others in the community. They use torture and repetition of communist creeds as well as educational materials. Fun times.
It should also be noted that the Chinese people do not have access to destruction like we do in the US. Their main methods are knife attacks and running cars into people. Explosives and guns are so tightly controlled as to simply be out of reach, so even when they do commit terror attacks, it’s closer to 2 people dead instead of 50.