Calling it a "TikTok ban" is sort of inaccurate, but unfortunately that's how the media and politicians have referred to it. The act doesn't ban TikTok; it bans TikTok from having China-based owners (in this case the Chinese company ByteDance). The act requires the China-based owners to sell TikTok to non-China-based owners or cease operations in the US.
I'm guessing Congress justifies its authority here based on national security. The bill refers to "foreign adversary controlled applications".