Democratic Rep. Joe Crowley will face his first primary in 14 years on Tuesday.

Mr. Crowley, who heads the House Democratic Caucus and the Queens Democratic Party, has represented New York’s 14th congressional district since 1999.

His opponent, Alexandria Ocasio-Cortez of the Bronx, didn’t work her way up through political clubs and has never held office. Her campaign to unseat the 56-year-old incumbent has relied on grass-roots canvassing, endorsements from national left-leaning organizations and an active online presence.

Ms. Ocasio-Cortez, a 28-year-old born in the Bronx whose family is from Puerto Rico, wanted to challenge Mr. Crowley’s position as leader of one of the most diverse congressional districts in the country. The district, which covers part of the Bronx and of Queens, is overwhelmingly Democratic, and the majority of residents are black and Hispanic, according to the U.S. Census Bureau.