I did a quick search, and found these from the FAQ. Both are pretty good answers to your question imho.
How socialist was National Socialism? answered by u/kieslowskifan and u/g0dwinslawyer.
Although the linked FAQ answers above are very detailed, I will try to answer more directly to the question of naming the nazi party
At first two premises: We have to keep in mind the field of political ideology is probably the most debated topic of the last century. So normally we have to put effort into defining what we mean by Socialism/Facism/Totalitarism and where we get our understanding from. Im not going to do that here. I linked useful information down below.
If we want to have a historical explanation, we have to avoid underlying the current usage and politic meaning of those political terms. I will give my best to try to explain compact and short.
--
Where does the name come from?
The Nationalsozialistische Deutsche Arbeiterpartei (NSDAP, National Socialist German Workers Party) was founded in January 1919 as Deutsche Arbeiter Partei (DAP, German Workers Party). It can be imagined as a small local club in munich where people of indifferent political views meet up and talked about the current political affairs. Later that year Hitler joined that club and when the party was growing it was renamed to NSDAP in 1920. Most historians explain the renaming with the existence of similar organizations in Austria/Bohemia and the Sudetenland. They shared same ideas, eventually the swastica as a symbol of the movement was also derived from them, at last they shared the name.
What is the political background of the early NSDAP?
What these clubs and movements had in common was a feeling of disgrace due to the lost war, trauma because of their own experiences in the war and ideas of antisemitism, e.g. the idea of a jewish conspiracy which lost Germany the war (see "Dolchstoßlegende / stab-in-the-back myth"). Closely tied to the topoi of the lost war and Antisemitism is Anticapitalism, for example also the idea of a Jewish conspiracy, this time on a global scale, to exploit all nations financially (see "protocols of the elders of zion") but also exploitation of German workers through industry and the business of the finance sector. Another element is a movement called "Völkische Bewegung" (roughly it is the idea of german speaking people uniting and valuing their culture, very roughly). All these aspects we can also find as key factors in German politics when Hitler came to power.
So where does Socialism come in?
Let's look at one of the few sources. The DAP defined their organization as "classless socialist organization, guided by german [in the sense of ethnic german] leaders". One of the concepts was "to unite nation and socialism". (Quotes are from Konrad Heiden, Hitler. Eine Biografie I, 1936/1937, p. 100 - Heiden was a dissident and had to emigrate to the US, one of the earliest biographies of Hitler) We surely can't presume a coherent political concept in these movements, social research found that most members were of "lower middle class"( Kater, The Nazi Party, p.23f., a little too old). Maybe we can assume, that they used the term by their best knowledge, as a popular term of that time.
So what did the early party members mean by national socialism?
As described in the quotation one part is a feeling to overcome an imagined division of society caused by communist "agitation" and capitalist exploitation. The solution is the unification against those enemies, key factor is the group. In opposition to communism the group isn't the working class ( although it's yet caught in Marxist semantics "workers") it is the german people (in an ethnic sense). This is the point where Communism and Facism part ways in my opinion.
So let's sum this up. Both ideologies share a certain idea of communitarism and oppose individualism (to use a few more -ism terms), therefore they share the term of socialism.
--
Further reading: Interestingly there is not too much new research on the Nazi Party in the period of 1919-1925. I used James Rhodes, The Hitler Movement - A modern Millenarian Revolution, 1980 which is okay. More compact is George L. Mosse, Towards in General Theory of Fascism, in: Id., The Facist Revolution, 1999, p. 1-44.
Too old for academic purposes, but a game changer ist Joachim Fest's Biography on Hitler (Fest, Hitler, 1974/2002). Best written monography of that time, gets you a general overview and a german perspective on Hitler. Although it is old, it has shaped research on Hitler in Germany, many authors will refer to it. There is plenty of stuff in political theory, I'm not too much of a fan of that disciplin. Sometimes an encyclopedia is enough ;) Try: https://plato.stanford.edu/entries/socialism/
I left out explanations on the term "Volk". This a whole new area and can be tricky for english speaking audience. The terms nation/peoplehood/population/folk have similar translations yet different meanings, as it is in english. If you're interested Patrick F. Geary, The Myth of Nations and Benedict Anderson, Imagined Communities are canon. This is my actual field of interest ;) Thanks for reading.