A corollary question: was it even logistically feasible to conduct a nationwide popular vote at the time the Electoral College system was established? Or was a "middleman" institution like the Electoral College a matter of choice rather than of necessity?
While more can always be written, you may be interested in these earlier answers to similar questions:
"Was the Electoral College really intended as a device against tyranny of the majority?" answered by /u/uncovered-history
"Why did the framers of the U.S. constitution institute the electoral college?" answered by /u/jelvinjs7
"Did the framers of the U.S. Constitution come up with the Electoral College as a way to give small states more influence, or is this just a popular misconception?" answered by /u/AvTheMarsupial
One thing I will add: uncovered-history is right in the TL;DR that they give, and is also right that it was a hot topic of debate during the Constitutional Convention. However, the debate didn't stop there. As recounted in the recent book Presidential Elections and Majority Rule: The Rise, Demise, and Potential Restoration of the Jeffersonian Electoral College by Edward B. Foley (Oxford University Press), the electoral college's anti-democratic role was challenged pretty much as soon as the Jeffersonians gained majorities and had any political power. Jefferson's party is referred to nowadays as the "Democratic-Republicans" for a reason: they were often called either the "Democrats" or the "Republicans" at the time they existed. And they were called "Democrats" because they were in favor of democratic reforms.
One of those early reforms was to make Presidential elections more democratic. They wanted to disempower the state legislatures (who often were of questionable representative democracy themselves) in selecting the President and Vice-President, and empower the people to elect them through a popular vote. Of course, it was, and still is, a step removed, since the popular vote was actually to elect a slate of electors to the Electoral College. Nonetheless, the reasoning behind the Electoral College was almost immediately challenged as soon as there were actual contested Presidential elections (post-George Washington). As Foley recounts, the debates in Congress in 1803 that led to the ratification of the 12th Amendment show that the amendment was designed specifically to put in place a "majority rule" system. The amendment was ratified by the Democratic-Republican-controlled Congress, who had supermajorities in both Houses, and then by state legislatures controlled by Democratic-Republican majorities there, too.
At the state level, Democratic-Republicans worked to employ a popular vote to select those electors. Being the "states' rights" proponents that they were, the Jeffersonian plan was for a "majority-of-majorities", the winner being the candidate who received a majority vote in enough states that made the majority of the electoral college. As Foley argues, it was only subsequent to the 1803 revision, and especially after the 1824 four-way race, that states were willing to accept pluralities as sufficient for electing a president. And while it was happening before, after that race, many more states adopted an official "winner take all" law in awarding their electoral college votes, since it increased their political clout. Eventually, all the states had a "winner take all" law on the books, until Maine and Nebraska enacted a modified version of it.
Nevertheless, it should be understood that, from the very beginning, the purpose of the Electoral College was called into question and underwent major revisions almost immediately.