It was supposed to be a prop gun but somehow must’ve been real and loaded.
This is a common misconception.
There is no such thing as a ‘prop gun’, they are always real guns, they are just loaded with blanks, which are shell casing with the explosive material but no bullet inside, so it makes the bank but nothing is fired out.
What has likely happens is that the gun was previously fired in another take and part of the blank rounds she’ll casing broke off and lodged in the barrel of the gun, on the next take it was fired and the piece of casing was ‘shot’ out of the gun.
It’s already been stated he was ‘firing at the camera in the scene’ the director and cinematographer would have been sat behind the camera so it makes sense.