The App Store has a few apps designed to make different electric guitar sounds and effects, but you can't exactly hook your guitar up to your iPhone out of the box. Here's how to do it with a simple DIY cable.
These instructions involve some soldering, though if you'd prefer not to break out the soldering iron (or you don't know how to solder), you can buy a few extra adapters and do it solder-free for just a few more bucks and a bit more bulk. You essentially need to buy a few jack sockets and a stereo video cable, connecting the sockets to the correct parts of the video cable to create not only a guitar input, but a headphone output as well. It certainly won't be the best amp you've ever used, but its portability makes it a nice cheap, makeshift amp that you can take anywhere with you. Hit the link for the full instructions.
Make a Cable to Use Your iPhone or iPod Touch as a Guitar Amp [Instructables]