What is so wrong with Hillary?
There are several ways to look at this question.
First, it is well-known in political science that people sometimes vote strategically, ie, they vote against a candidate rather than for them. This happens most often when there are only two options. (Yes, I do know about the Greens and the Libertarians running candidates, but these were fringe candidates.)
Another aspect is that there are types of candidates and the three relevant ones here are: legacy, experience and narrative. Trump was very much a narrative candidate, as were Obama and Reagan. Their USP is "vote for me so you can feel good". Clinton fell somewhere between experience and legacy but, unfortunately, both of those qualities had negative connotations with the electorate. Her legacy elements were her: time in the White House when her husband was president and her time as Secretary of State. Bill Clinton's was a very flawed presidency, which is why he was not trotted out as the typical loyal adoring spouse, eg Nancy Reagan, that is so often a feature of high-level US elections. Further, there were concerns about her judgement (the private email server) and her ability (Benghazi) as well as doubts about how she came to be elected at the Democratic's Primary elections in Chicago and concerns that she was fed debate questions in advance by the media.
Add to this the fact that many people plain just don't like or trust Hillary. It has nothing to do with her being female and everything to do with her personality - she just does not come across as likeable or warm or accessible. Agree or not, these are essential qualities for an effective politician. Calling a good percentage of the voting population "a basket of deplorables" did not help her cause not did her lack of transparency about her health, eg collapsing at the 9/11 ceremony and brushing it off as being "overheated" rather than admitting that it was pneumonia.
Lastly, Hillary represented the establishment, which further alienated a large swathe of the population who felt that their concerns were not being listened to. Whether or not one agrees with or shares those concerns is irrelevant: one of the jobs of a politician is to listen to what people are saying. Not doing so means that the person comes across as cold and remote and out-of-touch, which is one of the reasons Clinton lost.