I thought DHCP just assigns an ip address.
DHCP, does not just assign an IP address. It can also assign a host name (simple host name or fully qualified domain name). Actually, that is a very handy capability when you think of X-terminals and thin clients/zero-clients in your network.
DHCP may also assign network mask, gateways, routing information and metric for your internet device(s).
The host name is a weird property. A computer may have different host names on different devices. And to add more confusion, a host can have alias names added in DNS.
When you read the details of man hostname and other man pages referenced in there, you start to realize that Shakespeare was right to ask "What's in a name?"