He then heads down a stairwell.

Ms. Adesegun said on Saturday that she believed the mayor cared more about his workout than listening to her. Eric Phillips, Mr. de Blasio’s press secretary, defended the mayor’s decision to leave.

“People working out at the gym shouldn’t be worried they will be recorded in highly publicized, videotaped political confrontations every morning,” Mr. Phillips said. “It’s not the right venue for these discussions and the mayor won’t have them there.”

Homelessness has been one of the most vexing issues facing Mr. de Blasio. The Coalition for the Homeless, an advocacy group, says New York is in the midst of the worst homeless crisis since the Great Depression. The city’s shelter system houses just under 61,000 people, including more than 22,000 children. In seeking to open 90 new homeless shelters, Mr. de Blasio has struggled to find locations and to overcome resistance from existing residents opposed to new shelters in their neighborhoods. Mr. Phillips says 16 shelters have been opened so far. The city also recently moved to consolidate its confusing system of rental subsidies.

Giselle Routhier, policy director of the coalition, said the group began calling for Mr. de Blasio to increase the number of units in his housing plan about a year ago.

“We still have near-record homelessness and it’s not going down as much as it should be at all,” Ms. Routhier said. “You can’t address record homeless without dedicating a meaningful portion of your housing plan to homelessness.”

Over the course of his almost five years in office, Mr. de Blasio has been confronted at the Y.M.C.A. by the union representing uniformed police officers as well as by a large group calling for traffic-calming measures after the deaths of a 4-year-old girl and a 1-year-old boy who were struck by a driver a block from the gym.