This guide was found at IPmart forum. This guide is a result of months of constant research in iPhone unlocking. After lots of reading and thinking, I was finally able to piece many smaller guides into this one complete guide.
1. An iPhone, possibly brand new and unactivated.
2. Wi-Fi access.
I've already verified this on two out-of-the-box iPhones. I can't imagine it getting much easier than this...
(If you've already activated your phone, you can skip to step 11.)
Activating your phone:
1. Just after you buy your phone at your local AT&T/Apple Store, walk to the middle of the store and sit down on the floor with your legs out.
2. Open the box, turn on your phone, and slide to reach the emergency dial screen.
3. Enter *#307# and then press call. Don't forget the asterisk (*).
4. Your phone will ring itself. Delete all the numbers at the top, press 0, then call. Now answer the call.
5. Press hold now and your phone will start ringing again.
6. Press Dismiss and your phone will go into the Dialpad screen.
7. Press Contacts from the bottom bar and add a contact. Give it a random name (or no name) and then add new URL "prefs:" (no quotes). Now save the contact and click the URL. This will bring up your Settings menu.
8. Go to General, and change autolock to Never.
9. Now go to Wi-Fi. Choose your network and if you did it right you will see a Wi-Fi signal on top of the iphone.
10. Now press return to call, slide for emergency, press 0, answer the call, press hold, decline the call, and now add another contact, this time with the address "www.jailbreakme.com". (As an alternative, you can also try "www.slovix.com/touchfree/jb" which I've heard does the exact same thing.)
Jailbreaking your phone:
11. Click on this URL, scroll to the bottom of the page, and click "Install AppSnapp".
12. Your phone will take you back to the "Activate iPhone" screen. Wait about a minute, your phone will restart, and you'll find yourself at the homescreen with all your widgets, including Installer.
Unlocking your phone:
13. Press Installer, update it, and then go back in. Go to the Sources tab on the bottom, press edit, then add. As the new source, type in "http://i.unlock.no". Say OK, then press Refresh at the top.
14. Go to the Install tab, then All Packages, and then find and install Community Sources, followed by BSD Subsystem, Open SSH, and finally anySIM 1.1.
15. Exit Installer and run anySIM 1.1. It will warn you that you need to put in your new SIM, but this isn't true. Just leave in the AT&T SIM that came with your phone. Now Slide to Unlock, press the big red button, and wait about 5 minutes for it to finish.
16. Your phone is now activated, jailbroken, and unlocked! Stick in your new SIM and check it out! There's one small problem though - your YouTube is broken.
17. To fix YouTube, simply install YouTube Activation from Installer.
18. Go to Settings > General > Date & Time, change Set Automatically to off, and make sure the date is right. If it's wrong, make it right.
19. Go make sure YouTube is working.
There you go! How long did that take you? It took me about 10 minutes.