I know this is a stupid question but on some WW2 planes how does the gun in the front not hit the front rotor of the plane like the Bf109?

Other answer:

STEPHEN:
The Bf-109 had two machine guns mounted on the top of the fuselage that fired through the propeller. A mechanism called "interuptor gear" meant that the firing of the guns was timed so that the bullets missed the propellor blades.
The 109 also had a 37mm cannon that fired through the centre of the propellor boss. This was the real weapon.
Interuptor gear was invented in WW1. Before that they just put metal plates on the propellor to protect the blades.
Robert:
Th Bf-109 had its guns mounted in the fuselage, much like World War I biplanes, and as others have said, they synchronized the gun with the propeller. Th Bf-109's designers did this to keep the wings as thin as possible.

However, most World War II fighter aircraft actually mounted the guns in the wings, far enough outboard that their lines of fire completely missed the propeller, rendering the synchro gear obsolete.

The Wolf:
The machine guns were synchronize to fire the bullets between the blades of the Prop. The prop was turning fast but the bullets were moving much faster and they would get past the blade of the prop before the prop got in line with the bullets.
Techwing:
It's not a stupid question. They are synchronized so that the bullets are fired when the propeller blades are not in the way.
AlCapone:
The technology to synchronize the gun's firing with the propeller rotation was developed in WWI. It was much refined in WWII. It was called an interrupter gear or synchronization gear. Here's more details:

https://en.wikipedia.org/wiki/Synchroniz…