Hopefully the title is self-explanatory enough such that there are no ambiguities in the question. The scene I'm referring to.
Infantry firing at aircraft with small arms was certainly common. The 1941 US Army Field Manual FM 7-10, Infantry Field Manual: Rifle Company, Rifle Regiment, for example, stated:
"Action in case of attack [...]
Antiaircraft fire. In the absence of orders, the company commander decides whether or not fire will be opened on hostile airplanes. When concealment is essential and is believed to have been achieved, no weapons fire at hostile airplanes. When concealment is not essential, or obviously does not exist, all men armed with rifles, automatic rifles, and carbines open fire as soon as the attacking airplanes are within effective range of their respective weapons."
The particular scene in Dunkirk is reminiscent of a photograph from the Australian War Memorial: DUNKIRK, FRANCE, 1940. MEMBERS OF THE BRITISH EXPEDITIONARY FORCE FIRING AT ATTACKING LOW FLYING GERMAN AIRCRAFT DURING EVACUATION FROM THE BEACH.
Accounts can similarly be found, such as Jimmy Langley of the 2nd Coldstream Guards who in Fight Another Day, recalled an encounter with Brigadier 'Becky' Beckwith Smith:
"'Marvellous news, Jimmy' he shouted. 'The best ever!' Short of the German army deciding to call it a day, which seemed improbable, I could think of no news deserving the qualifications of 'marvellous' and the 'best ever!'
'It is splendid, absolutely splendid. We have been given the supreme honour of being the rearguard at Dunkirk.'"
'Becky' then addressed Langley's platoon, and gave his advice on dealing with Stukas:
"'Stand up to them. Shoot at them with a Bren gun from the shoulder. Take them like a high pheasant. Give them plenty of lead. Remember, five pounds to any man who brings one down. I have already paid out ten pounds.'"
In terms of effectiveness, though, the Brigadier may have been either exaggerating or mistaken with his generosity. Hitting a fast-moving aircraft from the ground was not at all easy, deflection needs to be applied - not pointing directly at the target but shooting at where the aircraft will be when the bullet arrives. Game shooting may indeed have been of some help, but was hardly the preserve of most infantry. Even if, via luck or judgement, a rifleman managed to hit an aircraft, a single .303 bullet would have little impact over most of an aircraft unless it somehow killed the pilot (usually protected by at least an armoured windscreen, possibly some armoured plates) or was enormously fortuitous in causing some sort of engine damage. The first marks of Spitfire and Hurricane used during the Battle of Britain had eight .303 machine guns, and German bombers were on occasion returning to base with upwards of 100 bullet holes. Light machine guns like the Bren were a marginal improvement on a rifle, but effective light flak used rapid firing cannon of 20mm-40mm firing explosive shells, and even then expended around 5,000 shells for each aircraft brought down.
Why bother? If nothing else, it might put off the aim of the enemy pilot, and by sheer volume of fire over the entire war some aircraft were probably brought down; The Battle of France: Then and Now records several Stukas damaged or downed over Dunkirk by anti-aircraft fire, though not the calibre or type of weapon involved. It at least gives infantry something to do rather than being helpless under air attack. Why wouldn't everyone do it? As mentioned it was generally ineffective, so a low priority if ammunition was limited, and self-preservation would suggest taking cover when under attack rather than shooting.