UYANG, China—One night this September, construction supervisor Chen Shouli fired off a joke in a chat group. “Haha,” he typed on his black iPhone 7, followed by an off-color wisecrack about a rumored love triangle involving a celebrity and one of China’s most senior government officials. Four days later, he says, the police telephoned, ordering him in for questioning. “I thought, I haven’t done anything wrong, have I? I’m law-abiding,” recalls Mr. Chen, a wiry 41-year-old. “So I went in. Once I arrived, they wouldn’t let me leave.” Mr. Chen was locked in a cell for five days, he says....