Sha Hailin, a standing committee member of the Communist Party in the city and head of the United Front Work Department there, is the highest-level mainlander to visit since cross-strait ties worsened under Taiwan's new government.
He arrived in Taipei for an annual forum on municipal exchanges as protesters shouted "Sha Hailin, go back to China!" at the capital's Songshan airport.
Dozens of demonstrators waved placards reading "Expel propaganda communist, defend Taiwan's sovereignty" and "(Taipei mayor) Ko Wen-je sells out Taiwan". Some supporters also rallied outside the airport with welcome signs.
The protester scuffled briefly with policemen before being taken away.
More From This Section
Scores of protesters rallied again when Sha visited a high school to open a sports festival and played table tennis with Taiwanese students.
Relations with China have grown increasing frosty since Tsai Ing-wen of the Democratic Progressive Party won the presidency in January. Beijing is highly suspicious of Tsai because her party is traditionally pro-independence, and has warned her against any attempt at a breakaway.
Sha stressed that the basis for peaceful cross-strait relations was the recognition of "one China".
"If we want to maintain peaceful developments in cross-strait ties, I believe the political basis cannot be avoided... We will continue to work hard to build and solidify this political basis," Sha, who heads the visiting delegation in place of Shanghai Mayor Yang Xiong, told reporters.
Asked about the protests, he said: "There were also many people who welcomed me. Their voices were small but their number was bigger."
Critics claim Sha, as Shanghai's propoganda chief, intends to push during his visit for reunification and accuse Taipei mayor Ko of "selling out" to Beijing.