Locked phones are usually offered for a price or with a contract, and can only be used with one service or network provider. Open phones aren't tied to a single network service and can be used with different ones. Companies can now unlock phones after the contract is over, and some will even let users unlock their phones.
Turn the phone off, hold down the Power and Volume down buttons, wait until the "No command" screen appears, choose "Wipe data factory reset" with the Volume Down button, and tap "Reboot system now".
Connect your iPhone to your computer, open iTunes, click on your iPhone's name, check for updates, and click the "Download and Install" button. If the software on your iPhone has changed, you won't be able to flash it right now.
Open the "Settings" app on your computer and scroll down to the "General" button. Tap About and find Carrier Lock. If "No SIM restrictions" appears on the service Lock screen, you can use your iPhone with any service. If it doesn't say it's locked, you may want to open it.