Here is how you enable the root user in macOS Monterey and earlier macOS versions, the macOS root user is disabled by default when the OS is installed.
As an admin user launch System Preferences from the Apple Menu and go to the User and Groups pane, you will need to authenticate first by clicking on the padlock icon down the bottom left, then click on Login Options to see some options on the right.
Then click the Join… button next to Network Account Server.
This will pop up a dialog window, from here click on Open Directory Utility…, this will launch the utility Directory Utility – go to the Edit menu and select Enable root user, then finally set a password for the root user.
That’s it the root user is now enabled.