On this page
Key remapping
https://medium.com/ryan-hanson/key-remapping-built-into-macos-c7953b1a62e4
If you only want to remap modifier keys, you can use System Settings.
Search for “customize modifier keys”.

Beyond that, macOS has a way to remap keys using a built-in tool called hidutil: