You have to follow this video as you open you phone. Be carefull when you open then phone. Connector in front of phone might be damage if you open to fast.
You need some tools. you can buy this tools on ebay. Search for iphone tools.
You might need a small blad/knife also.Buy it here
I just use a blade like this.
This is used to open iphone need the home button. Be gentle ! And take your time if you not can open with this.
Then battery is under logic board and you need to take the logic board out.
When that is done the battery is just take it right out.
But to make sure see this video for Iphone 4
Or for Iphone 3gs video here
Buy battery from ebay. It cost not more then 5- 8 dollar from china and sometimes you get free shipping