Zhang Yiming was having breakfast at home in Beijing in July when a message popped on his computer screen. A friend sent a link featuring President Trump, in which he said the coronavirus came from China and, as part of a U.S. response, he might ban TikTok, the hit video app Mr. Zhang founded.

Mr. Zhang was astonished. “China virus?” he told people around him later. What did the coronavirus have to do with TikTok?

From that initial shock, things quickly got worse.

First, Mr. Trump upped the stakes by ordering that TikTok’s parent company sell the app’s American operation or face a U.S. ban, on grounds it threatens national security through the data it gathers.

Next, as Chinese nationalists lashed out at Mr. Zhang on social media for not fighting the Trump order, Mr. Zhang’s heavy-hitting Western investors were applying pressure on him to do the opposite—heed the order and sell.

Mr. Zhang fired back at Mr. Trump on Monday with a lawsuit filed in federal court in California to stop the White House order. Then, he suddenly lost the high-profile lieutenant he had hired to extend TikTok’s globalization. Kevin Mayer, brought in barely three months ago from Walt Disney Co., announced Thursday he was quitting as TikTok CEO because the political circumstances had changed his role so much.

Thus has the Chinese founder of an app for teens, filled with goofy dancing and lip-synching videos, been dragged into the tense U.S.-China geopolitical relationship. Mr. Zhang, a 37-year-old admirer of Silicon Valley, always wanted the company he created to be seen as global. But not this way.

ByteDance CEO Zhang Yiming, left, and Apple CEO Tim Cook at ByteDance headquarters in Beijing in October 2018.

Photo: Imaginechina/Associated Press