There's multiple kinds of device locking:
1) iCloud: Activation Lock - http://support.apple.com/kb/PH13695 - This is a security feature so only legitimate (i.e., not stolen) redistribution of devices is possible. See: Turn off Find My iPhone Activation Lock - https://support.apple.com/HT201441 - If an activation lock was put on a device, only the owner of the account that applied the lock can remove it. Get them to remove it or return the item for a refund.
2) Device lock: "If you forgot the passcode for your iPhone, iPad, or iPod touch, or your device is disabled" click here --> https://support.apple.com/HT204306
3) Carrier lock: Read this link on "How to unlock your iPhone for use with a different carrier" - http://support.apple.com/HT201328 - Only some carriers offer the ability to unlock iPhone for use on any carrier. Follow the instructions in this article to unlock your iPhone.
To me it looks like #3 is at least one possible issue. Was this a used phone? If it was, the seller should have done all the things listed in this link: What to do before you sell, give away, or trade in your iPhone, iPad, or iPod touch - Apple Support If they didn't, return the phone and have them do it or get a refund. It may work now but it could present problems in the future.