Hello! I'll copy and paste an answer of mine that dealt with the reasons Germany invaded the USSR:
The reasons for Germany invading the Soviet Union can be divided into two distinct "groups". Firstly are ideological reasons and secondly there are practical reasons.
Starting with ideological reasons, Hitler's ideology of National Socialism was in a sense, built for a big showdown between Soviet Russia and Nazi Germany. In Mein Kampf Hitler makes it clear that his regime will be an enemy of Soviet Russia and that the Soviets, as the only real Communist nation in Europe, need to be destroyed. In Hitler's mind Communism, or Bolshevism was a natural extension of Judaism, and since Hitler was committed to ridding Europe of one, he would naturally have to destroy the other.
From Mein Kampf:
To-day Germany is the next battlefield for Russian Bolshevism. All the force of a fresh missionary idea is needed to raise up our nation once more, to rescue it from the coils of the international serpent and stop the process of corruption which is taking place in the internal constitution of our blood; so that the forces of our nation, once liberated, may be employed to preserve our nationality and prevent the repetition of the recent catastrophe from taking place even in the most distant future.
Hitler was around when Lenin was preaching his idea of "spreading the revolution" all over Europe. Hitler wanted to prevent Communism from spreading, and in order to do that he needed to destroy the source of European communism in Soviet Russia. Hitler was planning for a dramatic showdown between the forces of National Socialism and Bolshevism since the 1920's.
The second major reason that would fall under the category of "Ideology" was Hitler's insatiable quest for "living space" or Lebensraum for the German people. Hitler's ultimate goal was to build a trans continental power that was capable of taking on the United States who Hitler correctly prophesied as the next great superpower; Hitler had also experienced what the British blockade had done to Germany in World War I, and he wanted to make Germany completely self sufficient in resources. Hitler wrote in part two of Mein Kampf:
Germany decides to go over to a clear, farseeing territorial policy. Thereby she abandons all attempts at world industry and world trade, and instead concentrates all her strength in order, through the allotment of sufficient living space for the next hundred years to our Folk, also to prescribe a path of life. Since this territory can be only in the east, the obligation to be a naval power also recedes into the background. Germany tries anew to champion her interests through the formation of a decisive power on land.
Next we move onto "practical" reasons. We like to condemn the invasion of the Soviet Union as being a completely awful idea; but there were legitimate reasons for invading.
First off is resource shortages, specifically rubber and oil. Germany need both, specifically oil if they were to keep their air force ready to protect Germany from British and later American bomber fleets. The Germans had captured stocks of oil in 1940 but it only postponed the problem. By the end of 1941 the German army was actually considering decreasing its mechanization in order to aid in the fuel shortage problem.
Another chief concern was food. Beginning in 1940 Germany began to ration its food, and the Nazis became aware that there would soon be mass food shortages in Germany. By 1942 German soldiers had to begin living off the land in Russia, German rations at home were being cut, and rations to anyone not of German origin (poles, Jews, etc) were pretty much stopped completely. So the allure of getting the grain fields of the Ukraine, no doubt factored into the decision.
Finally, the chief strategic concern was to help bring Britain to the negotiating table. See Britain had been defying Hitler, not surrendering despite the massive air campaign designed specifically to bring Britain to its knees. This was infuriating Hitler and so he looked for other ways to bring Britain down when it became clear an invasion of Britain would end in failure. Hitler thought that Britain was only staying in the war because of the prospect of support from Soviet Russia and the United States of America; and so he figured by prosecuting a quick campaign to crush Russia, he could force Britain to sign a peace treaty. Hitler said to his generals that compared to what they had already done (the invasion of Poland, France, etc.) Russia would be "child's play".
Despite seeing the campaign as an easy one, Hitler still debated whether he should try another massive air campaign against Britain; one of Hitler's top advisers, named Alfred Jodl, convinced Hitler to attack Russia, citing Hitler's belief that war with Russia was inevitable and that it was better to do it while the Nazis were in near complete control of Europe.
So ultimately the driving factor in Hitler's decision to declare war on the Soviet Union was Hitler's desire to bring Britain to the negotiating table. A war between Hitler's Germany and Soviet Russia was inevitable, and I don't mean to downplay the ideological reasons; but its important to understand that it was practical reasons that took the forefront, not ideological ones. I think the best way of looking at it is like this: Hitler wanted to get all of his "ducks in a row", but since Britain would not surrender, he was forced to move the inevitable invasion forward.
My understanding is that paranoia played a huge part. Stalin and Hitler were both dictators who had paranoiac tendencies since they assumed they were being undermined by their beleaguered people. So despite their nonaggression pact they were both paranoid the other would break it. Then when one of them made back-up plans in case the other broke the peace, it confirmed to the other that they couldn't be trusted. I didn't research this, I'm just remembering my history of WW2 class from a couple years ago.
I'd also point another factor: Hitler had a plan to invade Britain just like I have a plan to date Jennifer Lawrence - and my plan might be more realistic. The reality is that Germany had no way to invade Britain. Even IF the Luftwaffe had defeated the British Air Force, the reality is that they did not have planes designed to sink ships like the Japanese did. And even IF they managed to sink the Royal Navy somehow, they didn't have the landing gear or logistic acumen to even get their soldiers across the Channel. Let's not forget that the Allied invasion of Continental Europe had total domination of the sea and air, and even then there were rough spots on D-Day. It would have been far more difficult for the Germans to cross the Channel.