In most cases, the password on you iPhone is not the same as the password on your Mac, unless you set it up that way.
Most people set up their PASSWORD for the iPhone with a 4 digit or 6 digit code. Your Mac Password may have be set up with a Alpha Numberic Code and or you may have set it the same as your Apple ID, iCloud Password.
This may help you sort it out, remember if the Mac is locked for a set period of time, you will need to wait until that time expires.
How do I unlock my Mac if I forgot my password?
Restart your Mac and hold down the Command and R keys until you see the Apple logo. From the Utilities menu, pick 'Terminal'. Type 'resetpassword' and hit enter. Follow the instructions on the screen to reset your password.