The Electoral College is perhaps the most underrated compromise the founding fathers were able to create when crafting the Constitution. At the time, the rift between large and small states was such an insurmountable issue that it threatened the Union's ability to survive the transition from the disastrous Articles of Confederation into a stronger more binding agreement between the states that allowed the federal government enough power to rule effectively.
This was an existential threat to small states who felt a large federal government would erase all the state power that they felt they had earned by fighting the British for their Independence. The Electoral College was created to alleviate these concerns by allowing the ability for a popular vote to be held to elect the leader of the Union, while still giving smaller states outsized influence simply by the minimum elector count for being a state. This gives citizens from both large and small states the ability to feel represented on a national level and stops a handful of large populations from teaming up and dominating national elections, wedging out the majority of the other states in the process.