Winning the popular vote but losing the electoral college doesn’t mean the electors voted in opposition to the citizens of their state. The electoral college was put in place so large population centers wouldn’t carry more sway than states with more rural or agricultural areas. It was meant to provide equity between states.