If you mean the server's hostname rather than a primary domain for the account, it can be changed in WHM > Change Hostname area, which will also update it in WHM > cPanel/WHM Basic Setup area.
After changing the hostname in WHM > Change Hostname area, you would also need to update the service SSLs in WHM > Manage Service SSL Certificates area to the new hostname.
Using Change Hostname area in WHM will update /etc/hosts and any other locations your system has the hostname set along with adding an A record for the new hostname (if you follow the prompt to add the A record).
If you also needed to change the nameservers for the machine, then you can change those in WHM > cPanel/WHM Basic Setup area at the bottom.
If this is not what you meant but the main account you use on the machine for a primary domain, the prior post I made covers changing the primary domain on any account.
Please note that it doesn't matter if that domain was the one used for the hostname and nameservers, if you need to add a new primary for an account that is used for the hostname and nameservers, you would first change the domain using WHM > Modify an Account area to change the domain on the account that has the old domain, then you'd change the hostname to go with that new domain in Change Hostname area, then you'd change the nameservers to go with that new domain in cPanel/WHM Basic Setup area.