The Founding Fathers were men of letters and well schooled in the potential peril of a pure democracy. Early Greek and Roman philosophers had identified these pitfalls. That is why we are organized as a republic.
The Electoral College was created to give each district (not state) a vote for president. The college voters were to be upstanding citizens charged with selecting the best qualified man to lead the nation. It was specifically designed to reduce the chance for a populist like Trump from becoming president.