Mac renames itself automatically - host name is incorrect in terminal
Yes you can :

sudo scutil --set HostName "YourHostName"
sudo scutil --set LocalHostName "YourLocalHostName"


to change the computer name : 

sudo scutil --set ComputerName "YourComputerName"


To check if everything is okay : sudo scutil --get HostName