Two reasons. One, the founders were afraid that an ignorant real-state mogul from New York could rise to the presidency by running a populist, hate-filled campaign so they thought that adding an extra layer as a safety measure would prevent it. In theory, voters don't elect a president but a number of 'wise men' delegates who would be supposed to be smarter than to fall for that kind of candidate. In fact, they never mandated that those electors be elected themselves- state parliaments could just appoint them without asking the citizens, as plenty of states did in the early years (South Carolina didn't hold a presidential election until mid-19th century).
Second, there was the issue of slavery. If the president were chosen through a national popular vote of citizens, then all those slaves would effectively not exist, and the slave-holding states were angry that a huge chunk of their population would just vanish like that. They wanted political power for all the slaves they had! So, by adding a 'representative' layer, they could appoint those proportionally to their overall population, regardless of whether they were citizens or slaves. The compromise was that slaves would count as 3/5ths of a human and they would count towards the non-slaves in those states being given more representatives to the House and electors to choose a president.
Except, not really. If every vote is equal, then every vote counts! If you're a small rural voter in Nebraska, your vote counts the same as that of a professional worker in San Francisco. Look at Texas- the largest cities in the state are deeply democratic, but republicans win by running up large margins among the millions of rural voters, and by getting a large minority of voters in those large cities too. And that's fine! In a presidential election in which every vote counted, Republicans would have a reason to campaign in California, because every vote they wrung out of the republican minority in that state would be relevant. But democrats would also get a reason to campaign in Mississippi and Arkansas!
Right now, the presidential election is decided by a handful of states that happen to be very close in the polls. When was the last time anyone campaigned in North Dakota? How many ads have been bought in Idaho and Oregon and Hawaii and Maryland and Alaska and California and Oklahoma? Zero. Who cares about what Vermont and New York and West Virgina vote? Nobody- they are already accounted for. The election is happening in Pennsylvania and Michigan and Wisconsin and Florida, everything else is just incidental. It makes even less sense.