Alexandria Ocasio-Cortez, the Democratic candidate for Congress who quickly became a star of progressive politics after winning an upset victory in a New York House primary this summer, came under fire this week for excluding the press from two community meetings that were otherwise open to the public.

Ms. Ocasio-Cortez, who is predicted to win the 14th Congressional District, which includes parts of Queens and the Bronx, did not allow reporters to attend town hall meetings with residents on Aug. 8 and Aug. 12, The Queens Chronicle, a local weekly newspaper, reported Thursday.

By Friday, the decision had become a flash point for arguments over politics and press freedom. Some journalists pushed back on Twitter and advocated open access to public events — one scoffed that Ms. Ocasio-Cortez, a political newcomer, would be in for a rough time on Capitol Hill, where reporters roam freely. Others on social media made comparisons with President Trump’s claim that the media is the “enemy of the people” and argued over what constitutes a public or private event.