Because right-wing and left-wing are just coalitions, and the groups within those coalitions change constantly. The Nazis were socialist, but they were right-wing socialists because they aligned themselves with those in the German Republic that considered themselves right-wing.