Because China is a much less pluralistic society than (even) India. Start with the one-part system etc.
China also blocks thousands of other Western websites, including traditional (Western) media. Or even Wikipedia (since 2019 at least). In the same year, China expanded its censorship of Western media outlets e.g. to the Washington Post and the Guardian. In general, China doesn't bother to provide a reason for their blocks of foreign websites, so one has to guess--it seems that anniversaries of politically sensitive events (like Tiananmen square) see a tightening of censorship in China, but there has also been a broader trend in the past decade (or so):
China’s Internet censors rarely, if ever, communicate their reasoning for blocking specific websites, and it’s not clear whether the ban would be permanent. Although authorities intermittently tighten and loosen their restrictions, the trend since 2013 has shown more and more foreign websites being irrevocably added to China’s blacklist.
Outlets such as Bloomberg, the New York Times, Reuters and the Wall Street Journal have been blocked for years.
Western media, e.g. the BBC is also "blocked" on cable in China etc.
On this backdrop, China was e.g. willing to let Google (search) exist in China, but under such strict rules that Google eventually pulled out in 2010, although by 2018 Google was apparently having second thoughts. However it seems these return plans have (still) failed to materialize. The choice that Google or similar companies faced is/was basically:
If Google remained aloof and continued to run its Chinese site from foreign soil, it would face slowdowns from the firewall and the threat of more arbitrary blockades—and eventually, the loss of market share to Baidu and other Chinese search engines. If it opened up a Chinese office and moved its servers onto Chinese territory, it would no longer have to fight to get past the firewall, and its service would speed up. But then Google would be subject to China’s self-censorship laws.
It's not clear if China even had any talks with other big on-line companies, e.g. Facebook, but it was probably a case of the gap being too great between what China would allow/expect and what these (other) companies would even consider. According to Wikipedia, Facebook was banned in China in 2009, again surrounding some politically sensitive event and Facebook's refusal to cooperate:
In China, Facebook was blocked following the July 2009 Ürümqi riots because Xinjiang independence activists were using Facebook as part of their communications network, and Facebook denied giving the information of the activists.
And, yeah, as Philipp's (unfortunately deleted) answer said, this ban on foreign social media companies also meshes well with China's nationalist promotion of their own tech industry champions. After the latter has had developed enough, it has become hard to draw a clear line between exclusion for political vs nationalist-economic reasons. Alas as noted in a recent NYT article, many/most Chinese nowadays don't even feel much need to use other (Western) on-line services... except when travelling abroad.
In difference to China, India din't press the "big off button" on an entire social media website in response to defiance by Western tech companies. (Or at least when they did it, this has been temporary/intermittent.) Also, as documented on Wikipedia, Indian telecom ministry has sent take-down orders for specific content to various big tech companies over the years (ranging from Google to Twitter), but these have sometimes been resisted or only partially complied with (e.g. Google did so in 2011, Twitter in 2021. This kind of "bargaining" was
probably much harder if not impossible for these companies to pull off with China.