They nearly filled the 13,000-seat Forest Hills Stadium in Queens — mostly New Yorkers, but also visitors from as far away as Portugal — not for a concert, but for a political happening.

The “New York City Is Not for Sale” rally on Sunday evening featured national progressive superstars like Representative Alexandria Ocasio-Cortez of New York and Senator Bernie Sanders of Vermont. But the main attraction was the city’s 34-year-old democratic socialist mayoral hopeful, Zohran Mamdani.

The size of the rally dwarfed anything seen in recent New York City mayoral races, and seemed more befitting a popular presidential candidate.

Mr. Mamdani’s campaign has emphasized affordability, and that message is clearly resonating in one of the world’s most expensive cities. Interviews, however, suggest that New Yorkers may be drawn to him for broader reasons. They are frustrated with the political system, including Democratic Party leaders, and the sense that many institutions are not working for them. For the first time in a long time, many of his supporters said, they felt hopeful.

Mr. Mamdani’s appeal to New Yorkers was on full display at the rally. Attendees came from neighborhoods as disparate as Ocean Hill, Canarsie, Jamaica, Park Slope, Ridgewood and the Upper West Side. They represented different races and religions. Those who spoke with The New York Times ranged in age from 18 to 72. Many had never participated in a political rally before. Here are some of the attendees.