is this other apple id yours of someone else's?
If the Apple ID is someone else's, then they did not logout properly before they sold or give away the MacBook .
You will need to contact them and ask them to follow these steps
What to do before you sell, give away, or trade in your Mac - Apple Support
If the other Apple ID is yours, you can try to regain the password via Apples iForgot service
If you don't have a trusted device, you can reset your password using a web browser – but the process may take a little longer.
When possible, the web browser will redirect you to a trusted device. If you'll have access to one of your trusted devices soon, it may be faster and easier to reset your password then.
Reset your password at iforgot.apple.com
If you have forgotten your Apple ID password – Apple Support (UK)