bmw does not utilize an egr (exhaust gas recirculation) valve. even if it did, it would not result in high hc readings if it failed. the egr system is used to reduce combustion chamber temperatures in order to reduce the production of oxides of nitrogen (NOx), and no, it is *NOT* the same thing as nitrous oxide...and no, it doesn't 're-burn' the exhaust. it's already 'spent gasses', for a simple definition. like trying to relight a match that has already been lit.
since the falilure in question is hc, which is a misfire indicator (co is the rich running indicator), i would say a tune up and a top engine clean is in order. the o2 sensor would also be a nice benefit, especially on a higher mileage vehicle. top engine cleaning is like a sea foam service. this product is available at advance auto. you could also use the stp fuel system additive. however, i don't pour either into the gas tank. i use a siphon type system that i 't' into the manifold vacuum to get the product into the engine. it smokes like there are no valve seals left while you are doing it, so please do not do where your neighbors will be affected. and *DO NOT* allow full suction of liquid into the intake manifold unless you wish to run the risk of killing your engine. (by the way, the old timers would 'decarbonize' engines with water drizzled down the carburator...same difference)
if, after you have diy'd the repairs mentioned or paid to get it done, and you still fail (you could still fail for NOx, as this is usually at it's highest probability rate where HC & CO are at their lowest rate) for any of the rated parameters, look at the O2 & CO2 readings. if the CO2 is above 14%, and O2 is above 0.5%, you may be looking at a catalytic convertor. if you pass, then happy joy. but still look at your readings. a 'just barely' passed is giving you a heads up to plan for future repairs.
any questions, feel free to pm me.