I regret that you’ve fallen into the trap that so many experience when purchasing a pre-owned device. You are most likely faced with 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.
When buying used, due diligence to establish the functional status and provenance of the device is critical. It’s likely to be of little help to you now, but this document authored by one our regular contributors summarises the pitfalls of buying second hand...
https://discussions.apple.com/docs/DOC-250001038
If you are the owner of the AppleID that previously activated the device - and you have forgotten your AppleID or associated password, these can be recovered here:
https://iforgot.apple.com
To recover your credentials, you’ll need access to one of the following:
- Your primary email address mailbox that corresponds with your AppleID
- Any of the secondary/recovery email addresses that should be configured for your AppleID account
- Any of the trusted telephone numbers (fixed line or Cellular/Mobile) that are associated with your AppleID
Unless you AppleID account has not been fully/correctly configured, or has been seriously neglected, recovery of the AppleID and password should not be difficult.
More information about recovery of your AppleID:
https://support.apple.com/en-us/HT201354
More information about recovery of your AppleID password:
https://support.apple.com/en-us/HT201487
When you recover access to your credentials, you would be well advised to log-in to your AppleID account from a web browser - and verify/update any email addresses and trusted telephone numbers:
https://appleid.apple.com