It was less than three weeks until Primary Day and, on first blush, the poll that Representative Joseph Crowley had been shown by his team of advisers was encouraging: He led his upstart rival, Alexandria Ocasio-Cortez, by 36 percentage points.

It was the last poll Mr. Crowley’s campaign would conduct.

Despite his many reputed strengths — his financial might as one of the top fund-raisers in Congress, his supposed stranglehold on Queens politics as the party boss, his seeming deep roots in an area he had represented for decades — Mr. Crowley was unable to prevent his stunning and thorough defeat on Tuesday night.

Ms. Ocasio-Cortez bested Mr. Crowley by 15 percentage points, delivering a victory expected to make her, at 28, the youngest woman ever elected to Congress.

If it takes a perfect storm to dislodge a congressional leader, then Ms. Ocasio-Cortez and her crusading campaign about class, race, gender, age, absenteeism and ideology proved to be just that. She and her supporters swept up Mr. Crowley in a redrawn and diversifying 14th Congressional District where the incumbent, despite two decades in Congress, had never run in a competitive primary.