The brief
The X2 had developed a rough idle, a hesitation off the line, and a check engine light, with a faint fuel smell around the engine bay. He brought it in for a proper diagnosis. That combination points at the EVAP system, and usually at its purge valve. That valve lets fuel vapour stored in the charcoal canister get drawn into the engine and burned, in controlled amounts, instead of venting to the air. When it sticks open, raw vapour leaks into the intake at the wrong moments, which upsets the air-fuel mix, so the engine hesitates and idles rough, and the computer sees the mixture wandering and flags it. The fuel smell is the vapour that isn't being managed properly. A small part, but it makes a healthy engine feel lazy and rough.
The diagnosis
Diagnostics pointed at the EVAP system, and a check of the purge valve confirmed it: the valve wasn't holding closed when commanded, so it was bleeding fuel vapour into the intake even at idle. The rest of the EVAP path, the canister, the lines, the fuel cap seal, checked out, so the valve was the fault. That's a replacement. The purge valve is a small sealed solenoid, you don't rebuild it, and one that's stuck only stays stuck, so it was getting changed.
The work
The old EVAP purge valve was unplugged and removed, and a new genuine BMW-spec valve fitted in its place, the hoses reseated and the connector clicked back home. Then the stored fault codes were cleared and the EVAP system rechecked on the scanner to confirm the new valve was sealing and opening when it should. A road test followed to confirm the idle had settled and the hesitation off the line was gone.
The outcome
Steady idle, the throttle responding cleanly from a standstill, no fuel smell, and the check engine light out after a drive cycle. The X2 went home running cleanly and emissions-compliant again. A stuck EVAP purge valve is a small part with an outsized effect, so swapping it and resetting the system put the running right and cleared the fault for good.