The 3G and 3GS versions of the iPhone have dedicated GPS chips in them. They use a technology called assisted GPS to help locate you in the world. The assisted part comes from using a Wi-fi or cellular radio signal to triangulate your general position. Then, when the GPS chip gets a good satellite fix, it will take over and give you a more specific location. Your phone looks for a Wi-Fi or cell signal first and then switches over to the GPS, if it does not find either of these.—Keene Haywood
A-GPS allows you to get a decent location fix quickly, while the GPS signal gives you accuracy. So when you are off in the wild, you can still get location information with your phone’s GPS chip, but it just might take a little longer to initially get a fix. The original 2G iPhone unfortunately does not have a GPS chip. Users are left to navigate with only Wi-Fi or cell signal triangulation, which is less accurate. iPod Touch users can use location apps, too, but are also relegated to the 2G iPhone’s location technology. Read about top iPhone mapping apps >>
Quick Tip: For those shooting with cameras and don't have a GPS with them, whip out your iPhone and take a picture which will geocode the image and can then be used as a location reference later when you get home and want to geocode your images. Your iPhone photos will be embedded with location coordinates, which most photo management software can read, such as Apple’s iPhoto or the new Aperture 3 which has a feature for using iPhone pics in just this way.