Unlocking a phone allows it to work with any GSM provider, you just need to insert the SIM card of your choice. If you enter the unlock code incorrectly more than 5 times, the phone will lock itself and will need service.
Well most phone have a limit number of try before they lock. So if you don't get it right within that amount it will lock itself. Then it must be unlocked by a professional before it can be used again.