Why do fighter pilots wear helmets?
There are several reasons:


A helmet provides head protection. A fighter airplane can make many sudden turns and a helmet provides reduction of the risk of a head injury.
If the pilot needs to eject the airplane, helmet is needed to protect from wind blast, in addition to what I mentioned #1.
Helmets play an important role in noise attenuation.
The mic and headphones are mounted in the helmet.
Many helmets contain a sun visor, hence the pilot does not require to use sunglasses.
Modern helmets have a mounted display, night vision support. The latest ones help to see the pilot in any direction they desire, and even through the airplane.
Oxygen supply mask can be directly mounted to the helmet.