The rationale for the Electoral College is more-or-less laid out by Madison in the Federalist Papers 51:
"Consequently, the great problem in framing a government is that the government must be able to control the people, but equally important, must be forced to control itself. The dependence of the government on the will of the people is undoubtedly the best control, but experience teaches that other controls are necessary."
That is to say it was felt that a direct popular vote put too much control in the tyranny of the majority. How do you prevent the tyranny of the majority? Basically, you can't, at least not passively.
The electoral college provided a balance against the tyranny of the majority by actively _enabling_ the potential for there to be a tyranny of the minority.
At least that was the rationale in 1776. It's not true so much in 2018, the idea that a direct popular vote could somehow put America under control of the godless coastal liberals forever is straight nonsense from the type of person who thinks votes for Democrat vs. Republican presidential candidates is say 95% to 5% in Massachusetts vs what it actually is, more like 60% to 40%.