Changing the hostname of your Raspberry Pi is easy.
Just follow these simple steps:
1.
SSH into your box with ssh pi@{IP} and enter your password.
2.
Edit the hostname in /etc/hostname. Use an editor of your choice to do so (i prefer nano).
sudo nano /etc/hostname
Change the name to whatever you like and save it.
3.
Now you need to edit the name in /etc/hosts right next to 127.0.0.1. sudo nano /etc/hosts
Note: the name in /etc/hostname and /etc/hosts need to be identical so double check for typos.
4.
Reboot your box with sudo reboot.