Nazi Germany invaded Poland on September 1st, 1939 for three primary reasons. First, to get back territories transferred to Poland by the provisions of the infamous Treaty of Versailles.
Second, to obtain Lebensraum (‘living space’ for Germans) to make Germany self-sufficient in food and key natural resources. And third, to make Poles servants (or even slaves) of German colonists and indirectly of other Germans.
Given the fact that the abovementioned territories have been taken away from Germany essentially at gunpoint, the first objective could be classified as legitimate and even noble. The second and third objective were, obviously, outright criminal.
However, it did not really matter. Because Nazi Germany had no other alternative but to invade and occupy Poland in 1939. For reasons that had nothing to do with Poland (except its geographical location) and everything to do with Reich’s security and even survival. And with the Soviet Union (more specifically, with its leader Joseph Stalin).
Adolf Hitler correctly identified the Soviet Union as the existential threat to Germany and to the whole European civilization. Actually, the USSR presented the existential threat to the whole global human civilization.
Given the promises that Hitler made to Germans (get back territories transferred to other nations by the terms of the Treaty of Versailles) and the unacceptable risks of defensive strategy (given the immense resources of the Soviet Union and Stalin’s firm commitment to conquering Europe) the only way to save Germany and Europe from this existential threat was to destroy the Red Army with a lightning-fast strike – the blitzkrieg.
However, to execute this blitzkrieg, Germany had to have the common border with the Soviet Union. And the only way to acquire this common border was to invade and occupy Poland that separated these two nations.
Hence, to save his country and the whole Europe from being occupied and destroyed by the Soviet Union Adolf Hitler had no other choice but to invade and occupy Poland (Lebensraum or no Lebensraum).