New Yorkers flooded the streets of Manhattan on Saturday aiming to send a message to President Trump that his hometown would be a center of resistance during his administration.

The mayor’s office estimated that 400,000 people took part in the march, which was in concert with other Women’s March rallies across the country. With huge crowds along Fifth Avenue near Trump Tower, a large slice of Manhattan came to a standstill for much of the day. Participants booed Mr. Trump and hoisted signs mocking both his hair and his relationship with President Vladimir V. Putin of Russia.

It was a moment of both catharsis and camaraderie in a city that was, for the most part, shocked and disappointed by Mr. Trump’s ascendance to the presidency.