Many political entities have names that can be misleading. Consider, for example, the
Holy Roman Empire (a confederation of mainly German territories during the Middle Ages and the early modern period) and North Korea's official name, the Democratic People's Republic of Korea (a totalitarian dictatorship). The
usage of the word "socialism" by the Nazis is different from the common usage of the term "socialism" to refer to an economic philosophy involving advocacy for social ownership of the means of production. The phrase "national socialist" was a nationalist response to the rise of socialism in Europe by offering a redefinition of "socialism" to refer to the promotion of the interests of the nation, as opposed to ideas of individual self-interest. But there was no policy of social ownership of the means of production. The Nazis did talk about capitalism being bad, but they defined it as a Jewish-originated economic philosophy based on individualism that promoted plutocracy in the interest of the Jews, at the expense of non-Jewish nations and races. This was put in contrast to the Nazis' conception of socialism, which was done in order to win over people attracted to anti-capitalist and socialist ideas to their cause. They rejected ideas of equality and working class solidarity, instead advocating for social hierarchy and national strength.
This article sums it up well.