Indy wasn't aiming at the Gestapo guy. He fired at the gun because it was becoming hard to see in the haze from the fire...well, that's my reason anyway.
Or it could just be that Indy did aim at the Gestapo and
accidentally hit the machine gun, causing it to discharge into the ceiling.
