Depending on which Mac you have and what settings you have setup this is not as easy as it sounds. Only on older Macs that don't have a T2 chip. mostly from 2017 and prior you can change the login password, but only if a firmware password, and if Filevault is not enabled.
On newer Macs, its not as easy since the mac is tied to your AppleID.