It could be many things, unfortunately and without experiencing the problem first hand or being able to do some basic diagnostic tests its hard to say. It could be a problem with the idle control motor, a vacuum leak or many other things, impossible to say without being able to do basic tests.
Most common cause would be a vacuum leak, secondly a idle control motor. If you do not have the equipment or know how this would not be a good vehicle to learn on. The two mentioned possible causes are the most common, but there a a lot more possibilities. We specialize in diagnoses Contra Costa Smog. If you have failed a smog check you may be eligible for C.A.P. money of $500.00 towards your repair. 925-947-2555