ok since now you know its a MAF problem you will notice that MAF sensors for a 2002 are maddd expensive. well don't worry there is a solution. do not ever buy a aftermarket MAF sensor because you will waste your money, happened to me 2 times. you gotta get a original nissan maf sensor but a 2002 sensor is like $442. so you gotta get the maf sensor for a 2000-2001 maxima, its like $90. i think this is the sensor i found it on courtesyparts.com
im pretty sure thats the sensor, and once you get this sensor you uninstall yours and you transfer over a little thermistor thing from the old sensor onto your new sensor and your good to go. look on the org there is a whole post about this and how to do it. save yourself the money and get the right part you will be happy.