We can swap mouse buttons by editing the registry value SwapMouseButtons under the registry key HKEY_CURRENT_USER\Control Panel\Mouse. To swap mouse buttons we need to set its value to 1.
Same thing can be done from command line using the below command.
reg add "HKEY_CURRENT_USER\Control Panel\Mouse" /v SwapMouseButtons /t REG_SZ /d 1
It requires a logoff or reboot to make the changes effective.
To configure this from GUI, you can follow the instructions here: Swap mouse buttons