The Electoral College is the indirect method the United States uses to elect its president: voters in each state choose electors, apportioned by that state's seats in Congress, and those electors cast the official votes. It is less a single design than a founding compromise that later party competition and winner-take-all state laws reshaped into something its authors would not recognize.
The framers never built a national election for president. They built a scattered set of state contests decided by a body of electors who were supposed to meet once, deliberate, and disband. That body no longer deliberates; the electors are pledged in advance and expected to obey. What the framers could not have foreseen is what happened when their machinery collided with two things they did not design: state laws that award every elector to the statewide winner, and disciplined national parties. Out of that collision came an outcome the original plan neither intended nor forbade. Five times, most recently in 2000 and 2016, the candidate favored by more voters nationwide lost the presidency to the candidate who won the right states.