This sounds like an Activation Lock...
Here are the Apple support pages that outline the Activation Lock - and the only mechanisms by which it can be turned off:
https://support.apple.com/en-us/HT201365
https://support.apple.com/en-gb/HT201441
As you will discover, unless you are the owner of the AppleID that was last used to activate the device, or unless you can secure the cooperation of the previous owner, you’ll not be able to defeat or bypass the Activation Lock. Without documentary evidence that you are the original owner (such as sales receipt showing the serial number), Apple won’t assist - and nobody here will be able to help you.
Sorry, you’re short of options.
Caveat Emptor:
The All Too Common SAD Reality of Buying … - Apple Community