There is a sticky covering this topic already, but I'll give you a quick preparation walkthrough to help you.
Since you're on 2.2.1 right now, this is the best thing to do.
First, sync your phone to iTunes to transfer any apps, music contacts, etc, you want to save. Then I recommend doing a complete backup.
Next, upgrade your OS to 3.0 via iTunes.
Next, do a complete phone reset on the phone to restore the phone to factory settings on OS 3.0. (this step is technically optional, but I tried it after I had issues with my first jailbreak, and afterward I had no problems). Resetting your phone takes about two hours.
Once you have a virginized iPhone 3G running 3.0 OS, do another backup just to be safe, and then follow the upgrade guide here:
http://forum.theiphoneblog.com/iphone-jailbreak-central/167172-jailbreak-unlock-your-iphone-official-tipb-3-0-how-guides-inside-updated.html
Once you complete that tutorial, you'll have a freshly jailbroken 3G. If you want to further unlock the phone, you can also complete the unlock portion of the tutorial at the end, if you also want to unlock your phone, but I don't recommend this if you're planning to stay on the AT&T network.
Good luck.