Please don’t take this as pro-Hitler, but didn’t he let the British army escape? I have read several times it was one of his biggest blunders.
The Germans did not press their attack as strongly as they could have. If they had, it's very likely the evacuation would have been far less successful.
Why they didn't do so is the subject of a massive amount of study over the years. But it really looks like it was mostly a matter of them not wanting to risk their tanks - losses to tank units had been quite heavy, and the ground around Dunkirk was not ideal for tank operations. So they stopped temporarily and that gave time for the evacuation to take place. Hitler and quite a lot of his Generals seemed to have believed at the time, that if Britain was allowed to withdraw across the channel, some sort of peace could have been negotiated - in essence that Britain would have agreed to a peace settlement in exchange for leaving Germany to rule Europe. That was a severe miscalculation in the end, but remember Britain was not capable of returning to Europe until it did so as part of a force combined with the United States. If the United States had remained a non-combatant power, it would have been years, if ever, before Hitler's rule in Europe would have been challenged. Churchill's speeches I quoted earlier show he was well aware that all Britain could do was fight a holding action to survive until the US became involved.
Yes, for some reason he got cold feet and held his units back from finishing the Brits off.