Odds are it was hacked or jailbroken to unlock it and the hack did damage to the phone.
Google "iPhone DFU mode". Put it in DFU mode and restore it. If it was hacked to unlock it, the best case scenario is that this will re-lock it to the original carrier. Only the carrier it is locked to can authorize unlocking it.
The smarter course of action would be to return it and get your money back, then use the money to purchase a phone you can use from a legitimate source.