It was a combination of factors.
One thing that’s very overplayed is the Maginot Line; the line of fortifications that France built along its border with Germany. In the popular imagination people often say that the French sat behind the Maginot Line and the Germans went around it through Belgium, but that’s just completely false. The French in fact built the Maginot Line to force the Germans to go through Belgium. The French sent their best forces and tanks to Belgium when the Germans attacked.
But what happened is that the Germans took a big gamble that paid off. Belgium can be roughly divided into two parts: