It is nowadays kinda a controversy to mention that there is a connection between those ideologies. An example is this debate on the EU parliament: https://youtu.be/1LfnbusMd_0
But, What is the historical background between the both ideologies?
Not to discourage further discussion, but there’s some great answers in the How socialist was National Socialism section of our FAQ from u/kieslowskifan and u/g0dwinslawyer.
This issue has been tackled in great detail by earlier posts. If you want a very thorough explanation, you can consult the FAQ.
The name “National Socialist” was adopted as a means of luring disaffected, working-class voters away from left-wing parties in Germany in the early 1920s. The party actually had very little to do with socialism, as they rejected many of the core Marxist principles. In my opinion, they are best described as far-right nationalists.