They weren’t clean “good guys,” chief. The USSR signed the Molotov-Ribbentrop Pact in 1939 mainly to buy time, avoid immediate war with Germany, and grab territory in Eastern Europe through the secret protocol. It was a cynical power move by one dictatorship dealing with another, not some noble friendship.
Then Hitler invaded anyway in 1941, because fascists gonna fascist. So the USSR later became crucial in defeating Nazi Germany, but that doesn’t erase that the pact was ruthless, self-interested shit.