Simply put, the polls were not wrong, the pundits were.
Using FiveThirtyEight’s final aggregated poll numbers, the outcome on election night differed by only 1.8 percentage points – well within any reasonable confidence interval. RealClearPolitics’ final numbers were even more accurate, off by only 1.2.
This disparity was statistically small, but enough to swing the election because of how close the race had become in the final weeks of the campaign. The last week of polls reflected the late narrowing in the electorate, but much of the analyst community dismissed the data leading up to the eve of the election.