Set a firmware password on your Mac - Apple Support
"If you can't remember your firmware password, schedule an in-person service appointment with an Apple Store or Apple Authorized Service Provider. Bring your Mac to the appointment, and bring your original receipt or invoice as proof of purchase."
If you forgot your Apple ID password - Apple Support
I suspect you're going to have a little trouble with resetting this password, if the Apple ID isn't yours.
Activation Lock for Mac - Apple Support
How to remove Activation Lock - Apple Support
If the Mac has been marked as Lost and placed under an Activation Lock, there is no way of removing the lock, except by entering information that you say that you don't know – or submitting a request to Apple, along with proof of purchase documentation that is satisfactory to them.
Activation Lock is designed "to prevent others from using your Mac" (or device) "if it's lost or stolen". The idea is, in part, to make stolen Macs, iPhones, and iPads worthless to thieves. If the Mac in question is one which is under an Activation Lock and Apple is not convinced, to THEIR satisfaction, that you have the right to remove it, Apple will not remove it.
if you bought this Mac used, from someone who did not properly prepare it for reslae (or a used computer shop that did not check that the previous owner had properly prepared it for resale), and THIS is why you don't have any of the passwords or passcodes you may be out of luck. If it was Activation Locked and you bought it used, without knowing that, then you may have bought yourself an expensive paperweight, and a costly lesson on what to check for before buying a used device next time.
The Apple Community article by 'lobsterghost1' goes into this in more detail. (While it is oriented towards the used iPad/iPhone market, a great deal of what it says could also apply in the context of used Macs.)
What to do before you sell, give away, trade in, or recycle your Mac - Apple Support
Apple Community – The All Too Common SAD Reality of Buying a Used iPad/iPhone