I plug in my air flow sensor and my car chokes and won’t idle, when I remove it my car runs great, changed it with my boyfriends ( exact car) still dose the same thing, he passes smog , that’s what I’m attempting at?
You might need a new MAF sensor. Those can get dirty and when they do the engine doesn't like it. Try cleaning it with some compressed air or BrakeKleen, and if that doesn't work, you need a new one.
As Jonah said, try to clean it.