Trump is the 5th president to win the EC vote but not the popular vote. Only one president lost the popular vote and electoral vote and still became president.
The founding fathers wanted a way that no matter how many votes a candidate got in any single state all states would have at least some say in the final tally.