Wow.. there could be a lot of issues but I would look for simple stuff first.
1. air filter: check to make sure it's has been replaced and cleaned.
2. MAF sensor: make sure that your sensor to air intake in plugged in tightly
3. Plugs: Last tune up?
4. ignition coils: pushed in all the way?
5. air intake hose: check for air leak
Most likely since this happened while driving, it's probably the clogged air filter or faulty MAF sensor. good luck