Clean the throttle body and the idle air control (IAC). The IAC is what control the idle speed. You may have other problems, but start at the device that controls the idle speed that, by the way, is know to cause problems when it ger dirty. In extreme cases, the IAC will need to be replaced, but try cleaning it first.