Sounds like a classic case of plugged fuel filter...Could also be plugged catalytic converter, but this is unlikely unless you have run a lot of leaded gasoline in the past.
Plugged cat converter is very, very common. $1,400.00 part from the dealer. The aftermarket cat. Converters typically do not perform to BMW specifications and the Service Engine Soon light will most likely retune causing a failed emissions test result.