Q:

Why is the front part of the engine not painted?

The engines are always painted a certain colour but the front part is always grey.
Source

And here on the XWB:

Source
Why is it that?

A:

The engine inlet lip is bare metal to facilitate anti-icing. The area is heated from within using hot engine bleed air.
This partial schematic (from Boeing AERO QTR_01.12) shows the engine anti-ice valve, which controls the air supply to the inlet lip:

Interesting side note: Even the 787 "no-bleed" system architecture uses bleed air for engine anti-ice.

A:

There are two reasons I can think of for this:

Aerodynamic reasons. Believe it or not, even paint can change the dynamics of a plane, to the point that Boeing discourages  multi-colored paint jobs or liveries on 787 nacelle, claiming they affect performance.
If that part of the engine were painted, there would be risk of paint chips being sucked into the engines, potentially damaging them. While this may seem far-fetched, this account shows that even paint chips can pose a foreign object debris threat to an engine. By not painting this part of the nacelle, the risk of paint flecking off and into the engine is reduced.

