A large part of Trump's win was due to half the population's dislike for Hillary Clinton. With Bernie Sanders, the dislike factor would have been non-existent and his chances of beating Trump would have been far better. Clinton's policies were more sensible and she won all three debates convincingly, but the dislike factor rendered that useless.
Maybe Sanders could have beaten Drumph, but no one knows for sure. It's still a bad dream that we have a tiny fingered, fake hair wearing cheeto colored PEOTUS. Sanders is also an outsider, and I think people weren't sure he could generate enough support to beat Drumph, but who really knows. People are still feeling the Bern, and we're still hoping that Sanders continues to be outspoken in the Senate.
Bernie Sanders would have beaten Donald Trump because he was simply a much more exciting and interesting candidate than Hillary Clinton, especially for younger people. Clinton represented a continuation of Obama, while Sanders represented a possibility for real reform and real progress. Young people were not as enthusiastic about Clinton. They would have turned out in record numbers in support of Sanders.
Hillary Clinton only stood for career politics. She stood for angry people who want to complain about others. It is hard to run for nothing. Sanders, on the other hand, had a vision for the United States. He believed in positive things. That would have been a more effective message against Trump.