It was created to address a series of technical and political problems that were present in the early days of our democracy—most notably, the issues of slow communications (it took tremendous time and effort to get vote tallies back to Washington from distant states) and of suffrage (the idea of a pure popular vote was a hard sell when you had Southern states containing large populations of enslaved African Americans and unenfranchised women). But we've been doing this national election thing for a couple hundred years, the suffrage issue is sorted out, and we have good telecommunications—so why do we still have the Electoral College? In a word: Federalism. In a few more words: The framers of our Constitution deliberately set up an indirect democracy.
There are lots of interesting arguments for and against the system. In the below video, YouTube educator C.G.P. Grey explains the issues inherent in the Electoral College. Take a look, and consider the question: Is this system really fair?