No one sets out thinking they will be on the wrong side of history. So doing things that they believe is wrong simply would not occur to people. If Batman beats up bad guys on the street it is ok. But the second that you become one of those bad guys who are only trying to achieve your objective he is a barrier to that and as such a threat to be neutralized. The problem with sides is that there are always at least 2 of them.
Hitler came into power when Germany had been beaten down by a bad end of a war, the economy was in terrible shape and the people where having a hard time just making due with things the way they were. So what does he do? He finds an out by blaming a minority of the population for the woes of the nation, promotes national unity by coming together against them, and in all of it rebuilds the economy of the nation. I am not saying that he was right, but even the US President and Prime Minister of the UK at first were impressed at what he had accomplished and how he was working to rebuild his country. In his mind, he was doing right, yes people were being killed and hurt, but it was for the sake of the country that it happened, and as such, was justified.
History does not side with him, nor does it side with anyone who lost a cause, as history sides with the victors. Complex issues become simplified for naritaves sake, and when it is written we agree with those who won. The Civil was was not just about slavery, it was as much about states rights, and the rights of self determination, things which to this day we argue about, and feel we must have. Of course since we still argue about self determination, and the ability of a state to determine it's own laws and rules, the simplest solution is to put it on slavery since we tend to agree that slavery is not such a good thing. The North wins the war, the south looses and it becomes not about the fact that Lincoln was elected without the support of nearly half of the nation, but rather it was all about slavery, since we know that slavery is bad.
No one picks a cause that they do not agree with and stays with it, otherwise how could you fight for it when it really mattered. If you did not believe in a cause and it came down to dying for it, or leaving the cause, if you did not believe in it, would you stay and fight for a cause which you were only half heartedly invested in. No one does what they think is wrong unless it has some value. Even a person who steals or robs a bank, even though they know that it is frowned upon or is wrong in the eyes of society, sees it as having some good for them, elsewise they would not do it. The shoplifter believes that his own good is more important or valuable than that of the corporation, or employees, and though it is wrong, it is still justified and he is still doing something that is in a way right for him.
Much of this is primal. We do what we do without thought of morals or what is right and wrong. When a person flips a light switch, they are not thinking about the damage the power the light will use is doing on the native species of the river system in which the damn his electrical power company gets the power to give him that electricity, Much the same way that if a person thought of the global impact of mining the natural gas to heat his home, instead, when it is cold, he turns up the heat, no further thought needed. He may be doing wrong, but not because he is thinking that in turning up the heat he will force the gas company to mine more, thus impacting the flora and fauna of the surrounding area. If he did think about it all, the larger implications of all of his actions, it is so that a man would simply not do anything, as no matter what he does he could be doing wrong against someone else or something else.
So we drive our cars, feeling like it is ok to do so regardless of the pollution it gives off. We power our homes and our machines while exploiting many natural resources that will never be reclaimed. We do this, because we think that it is right, whether time judges us as so or not. No body does wrong because they believe that not only is it wrong, but that there is no redeeming value in it. Even a person who hates their job, disagrees with what the company does or how they treat employees or each other will admit that it provides them with a source of income and thus for them the bad is trumped by the value they get out of it. They may not be right, but the ends make the means, whether right or wrong, justified.