You will need your iphone 3g jailbroken with the latest firmware at the time (2.2) if you already have this, restore it via itunes, and then go to the step #3.
Step #1: You will need to update your iphone to the latest firmware. You can do this with itunes, connect your iphone 3g, and choose update. This will update also your baseband, that´s what we need.
step #2: After you have updated your iphone 3g, you will need to jailbreak it with quickpwn. here you can find the guide to use quickpwn, use the same steps as the iphone.
step #3: When your iphone is jailbroken, its time to unlock it. You can use installer or cydia, add the following source:
CYDIA:
http://apt9.yellowsn0w.com
installer:
http://i.yellowsn0w.com
install it, and reboot your iphone with the sim installed. Wait about 90 seconds, and if you can´t still see your carrier, pull the Sim and try again.