If you have an old user account on your Mac that you can no longer access, there's a way you can still get into it as long as you have an "Administrator" account on that Mac. Just get into the System Preferences from the Apple Menu and click "Users & Groups". Then click the lock icon and enter the admin name and password. Select a user, and then click "Reset Password".
You can also reset your login password using your Apple ID. First restart the system, and when the login window appears, click the question mark that's in the password field. Then you can click the arrow next to "reset it using your Apple ID". Enter the Apple ID and password that's associated with that account, and follow the instructions for resetting the login password.
For more information on resetting login IDs on the Mac, check out this Knowledge Base article at support.apple.com.