A 16-year-old Taiwanese singer in a Korean pop group became an unexpected lightning rod in Taiwan’s elections, and likely gave a boost to opposition, pro-independence candidates in their landslide victory.

Chou Tzu-yu had appeared with a small Taiwan flag on a variety show on South Korean television. Chinese, who see the Taiwan flag as a symbol of the island’s independence from China, took to social media to denounce Ms. Chou, and on Friday, the eve of the elections, Ms. Chou’s management company posted a video on Youtube that showed the member of Twice reading an apology for holding up a Taiwan flag.

In the video, Ms. Chou said she’s withdrawing from all of Twice’s activities in China. With a blank expression, she read a statement, saying, “There is only one China. The two sides of the strait are part of one whole. I am proud to be a Chinese person.” JYP Entertainment, which owns Twice, issued a separate written statement apologizing to Chinese fans.

The video proved a rallying force for Taiwanese voters on election day. The words in her statement come close to Beijing’s official formulation for relations with Taiwan and served as a reminder of China’s goal to bring the island under its rule, by force if necessary.

While modern Taiwan was founded by the losing party of China’s civil war in 1949, many young Taiwanese people feel no connection to China and espouse a separate Taiwanese identity.

A supporter of Taiwan's Democratic Progressive Party holds up a placard of K-pop artist Chou Tzu-yu, a member of the South Korean all-girl band Twice, who was forced to apologize after waving the Taiwanese flag. Illustration: Agence France-Presse/Getty Images

“The incident made me so mad,” said Kenneth Lin, a computer engineer living in Taipei. “When I saw it, I booked my bus ticket home right away to vote.”

Ms. Chou’s video sparked such a firestorm that Tsai Ing-wen, the winner of the presidential election, addressed it in her first press conference Saturday night.

“An entertainer who is working in South Korea, a 16-year-old girl, was oppressed for holding the flag,” she said. “This incident has infuriated the Taiwan people. The incident will forever serve as a reminder that as president, my most important duty is to unify this country, to strengthen this country.”

The video likely didn’t change the election’s outcome. Ms. Tsai and her independence-leaning Democratic Progressive Party were already widely expected to win. The outgoing president Ma Ying-jeou, a politician from the ruling Kuomintang or Nationalist Party, stepped down after serving two full terms and his policies of building closer relations with China helped batter his approval ratings.

But anger over the video may have helped get out the vote, widening Ms. Tsai’s victory margin to 56% of the vote and helping the DPP for the first time win a majority in Taiwan’s legislature, with 68 seats out of the 113 total.

Lee Shu-Chuan, the secretary-general of the Kuomintang, or KMT, didn’t provide an explanation for his party’s election rout during a press conference at campaign headquarters Saturday night; he said the party would issue a report in coming weeks. Asked by reporters if Ms. Chou’s video was a factor, he said “yes.”

KMT leaders had also given their public support to Ms. Chou, although it didn't appear to help them at the ballot box. Eric Chu, the KMT presidential candidate, denounced the video, and President Ma said, “I want to tell Ms. Chou, you have no need to apologize.”

China’s Taiwan Affairs Office also issued a statement Saturday to warn against using the incident to fan discord. “Regarding some Taiwan political forces using some individual incidents between the people on both sides of the strait to provoke people’s feelings, the compatriots on both sides of the strait must be very careful,” the TAO said in its statement.

South Korean media reported in the past week that Ms. Chou’s flag-waving appearance and the anger it provoked in China had affected JYP Entertainment’s business in China, prompting Chinese tech giant Huawei Technologies Co. to drop an endorsement cooperation with Ms. Chou. Huawei did not immediately reply to a request for comment. Ms. Chou could not be reached Sunday.

In its separate apology to Chinese fans on Friday, JYP said Ms. Chou’s activities in China were being suspended. “Once again, we feel sorry for disappointing our fans in China who love our singers and girl groups,” the statement said.

Chang Ya-chung, political science professor at National Chengchi University, said the controversy reflected frustration at Taiwan’s longstanding ambiguous political standing: that the island is de facto independent but because of China’s claims and pressure, is denied the international stature of a sovereign country.

“This ambiguity has made it hard for Taiwanese to tell the world who they are,” said Mr. Chang.

-- By Eva Dou and Jenny W. Hsu in Taipei and In-Soo Nam in Seoul