Activation Lock is a mechanism to prevent the iPhone from being initialized without permission. Even if your iPhone is lost or stolen, you will not be able to operate your iPhone without your permission if you have Activation Lock.
In the first place, iPhone cannot be used immediately after purchase. You can connect to Apple's server (activation server) via mobile line or Wi-Fi line and move to the operation screen without receiving confirmation of serial number etc. If the iPhone is determined to be different from the information held by the activation server, or if you lock it manually from icloud.com, the activation lock will be performed and you will not be able to use the iPhone until you release (reactivate).
Your iPhone, which is not related to theft / lost, may also be activated. A typical example is SIM card replacement immediately after SIM lock release. If you replace the SIM card with a different carrier from the one just before the cancellation, be aware that activation lock will be activated. The solution is simple, just enter your Apple ID (email address and password) on the screen that shows Activation Lock.
If an activation lock occurs on a second-hand iPhone, contact your dealer or seller. If you go to iCloud.com and tell them you want to delete the target iPhone that is displayed on the "Find an iPhone" screen, you are safe. Activation unlock should be possible as soon as the iPhone is removed from their account.