India did it as a kneejerk response to the Doklam border incident of 2020. When you don't intend a full scale war,the other recourse is to hurt China economically. I distinctly remember the wave that followed of boycotting Chinese goods as much as possible. TikTok is the outcome of that.
While it doesn't do much politically, the ban was to hurt Bytedance. When 80-100 million people go dark on a certain social media platform, those numbers don't look good. When Bytedance wants MAU stats to leverage against the next expansion loans or merger (possibly), this could hurt them. Or simply revenue from ads. With the US it is pure political influence on the sly which the government is afraid of. Indians are tough audience to sway that way from my experience.