please give us your PS1 prompt string
echo "$PS1" | cat -vte
This will tell us what your Mac thinks it. From that we will know what to look at
For example, with zsh as the shell, here is what my prompt string looks like
echo "$PS1" | cat -vte
%n@%m %1~ %# $
The trailing $ is from cat -vte indicating where the end of the line is located at. The $ is not part of the prompt.
%n is suppose to be your username, which should be the same as $USERNAME
%m is suppose to be the hostname up to the first period.
%1~ is suppose to show the name of your current working directory (just the name and not the full path).
%# will translate to % if you are a normal user, and # if you are running as root.
Knowing what your PS1 value says will go a long way to figuring out what is happening.
NOTE: Often the hostname is obtained by doing a reverse DNS lookup starting with your IP address and asking the DNS server what the hostname is. Often times the DNS server (typically your home router, acting as a local DNS server and a cache for the ISP's DNS server) will not have a translation from IP address to name, so macOS DNS lookup will return the System Preferences -> Sharing -> Computer Name. But if the DNS server does return a value, then that value is displayed.
I've seen this happen when a Windows computer registers its host name with the home router for DNS lookups. Because most home IP addresses are assigned by DHCP, when DHCP lease period expires the IP address to the Windows system maybe given to another computer, in this case your Mac, and when your shell does a reverse DNS lookup it gets the information stored by the Window system.
Typically this happens when systems are disconnected from the home system so that they are not still using the IP address (laptops come and leave the house).
Also it is not just Windows that can register a DNS name. Other devices can do this. I was just using Windows as a common example.