What's the difference in unlocking and jailbreaking?

My dad just gave me a preowend iphone 4 and i need to know what is the difference? Also if possible a simple free way to change the phone company?

Jailbreaking add cydia app. It installs a few free tweeks amd themes.
to unlock a iphone 4 you need to be a current customer off 2 year contract.
if not you will need to pay

Unlocking - removing the 1 carrier restriction
Jailbreaking - hacking iOS to more mods

Depending on which version of iOS it is running you could do it free.http://iclarified.com/unlock

Jailbreaking is a way for users to add hack, tweaks, apps and anything else not supported by apple.

Unlocking is removing your carrier from the iphone allowing you to change companies. This is what you are looking for. There's a way to do this buy jailbreaking using an app call ultrasn0w but thats for older iphones. What i did with my iphone 4 is i went to ebay and looked for iphone unlocking. If the right side of your phone has a sim slot then you can unlock but if it has nothing then you're out of luck