Well, the free city of Danzig and the ‘Polish Corridor’ had been carved out of Germany after World War I.
In the 1920s, the Poles knew they most likely wouldn’t be able to keep Danzig, so they built their own port in Gdynia.
"Germany" in 1914 had carved up a number of neighbors, so when it (and Hungary) were carved up after losing, that's when the lands went to other states.
However all of that is moot - Hitler wanted to eliminate Poland as a whole - and he did that between 1939 to 1945 - Gdansk/Danzig was an excuse.