If main.cf file has myorigin = /etc/mailname then $myorigin is set to the domain name in the file. To change the domain name just change the domain in the file.
https://serverfault.com/questions/857303/setting-a-domain-as-primary-for-the-mailer-daemon-in-postfix-dovecot