I have a BMW Z3, 1999. At idle, it sputters a bit and feels like it's going to stall but just as it bangs on, it first feels like a misfire. The car drives fine when it's warm, and idles under 1,000 RPM.
Those things are notorious for getting vacuum leaks on them because the tops of the engines are all made out of plastic--including the intake system. Especially on the driver’s side, there are all kinds of plastic piping. You’d want to look for the vacuum leaks first and if you’ve got a vacuum leak it’s going to do all that stuff. Now, if you don’t have a vacuum leak, those are also notorious for having very bad MAF sensors. Mass air flow sensors--check that with a scan tool too. But, it’s often vacuum leaks on that car. It’s really typical when it gets that old. I would have a certified mechanic, such as one from YourMechanic, inspect your vehicle’s misfiring and stalling issue so that you know exactly what should be repaired.