In war, various factors, like the element of surprise, can allow the offense to temporarily overcome an inherently stronger defense. In 1940, the Germans quickly overran the French by catching them off guard tactically and strategically. The French couldn't adapt their defense quickly enough and suffered too many crucial losses early on.
Next year, the Soviets fared even worse than the French initially; but due to geography they managed to survive two crucial years and, at Kursk in 1943, they showed how a well designed defense could stop cold even the best German tanks. The French themselves had a similar experience in WW1: after initially surviving for two hard years, they gave the German attackers a very bloody nose at Verdun.