I own a 2006 Malibu Maxx 3.5, last night a neighbor replaced my air filter, and after I went no more than two miles the check engine light went on . I will add that the filter was dirty but nowhere near what I saw while I was researching the problem. I do have a fixed, put on and got a code of P0401, exhaust gas recirculation flow insufficient, does that have something to do with the filter being changed and I am also adding very quickly, My ex-husband is a mechanic and lives far away, I am trying to do the little things on my own and hope this is an easy one . also I noticed the filter has two different patterns,which side should be on the bottom metal mesh or pleated filter? Looked in daylight and I see the box where the filter goes ,attached hose and I guess the sensor that pluggs into the side .hope that helps.
You likely have a dirty EGR valve, dirty EGR pipe/line, gasket (see here for a listing of the parts). These parts total about $100, labor $60-$100. If you ignore the CEL, your head temperatures will run high and you'll wear out the engine prematurely.
There's nothing wrong with the air filter installation. It's not uncommon for a check engine light and codes to appear after changing the air filter. The improved air flow of the new filter changes the dynamics of the sensors so that they work properly.
It's best to buy the parts you need, then call ahead and ask mechanics specifically the cost of their labor. You will sound like you know what you are doing and will not get ripped-off. No ex-husband needed!