sounds like you recently disconnected the battery- and your throttle body is very dirty....
when you do this, the computer forgets parameters that it has learned over time.
so when you run the car again- it runs OK.....but turn on the AC, or recirculate air button (both turn on the compressor), you get this idle fluctuations that go up and down and at times will kill your engine. (at idle, or slow driving and making a turn, or on highway it wont shut off, but you can feel the drag).
the fix is simple.......
get throttle body cleaner ($5)
disconnect battery (for at least 30 min).
clean the throttle body.
should be fixed.
for instructions on how to.......
theres pics and directions over there/