The relationship between a factory reset and cellular service may not be immediately evident. Allow me to clarify:
When you perform a factory reset on a mobile device, such as an iPhone, it essentially restores the device to its original factory settings. This process erases all data, apps, settings, and personalizations that have been added since the device was first purchased. It is essentially a way to start fresh and remove any potential issues or conflicts that may have arisen during the device's use.
Unlock what? Carrier lock or Activation lock or Passcode Lock or Security Lock?
Carrier Lock:- Request your iPhone’s original Carrier to unlock your iPhone and if they agree and do it, then you may know the further process here --> How to unlock your iPhone for use with a different carrier ...
If you are the owner or the owner has shared all information with you then open Activation Lock:- If it is Activation locked, read here --> Turn off Activation Lock - Apple Support Activation Lock for iPhone, iPad, and iPod touch - Apple Support
Learn how to remove a device from a previous owner's account.
If you are not the owner and do not have the Apple ID and Password then there is no way that you can get into this iPhone unless the original owner shares the Apple ID and password with you. If you are lucky you can get into this iPhone if they (the owner) accidentally remove the device from their Apple ID.
Lock Screen Passcode
Following this process is the only way out if your iPhone is disabled. The steps given in this link will help you reset the passcode -> If you forgot the passcode for your iPhone, iPad, or iPod touch, or your ...
If you see an iPhone or iPad unavailable message or a "Security Lockout" screen
If you forgot your passcode, you can use your Apple ID and password to erase and reset your device without a computer.
Learn what to do if you see "[Device] unavailable" or "Security Lockout" on your iPhone or iPad.)