First of all, the hosts file is a relic of the past. In the early days of the internet, the file was used to link domain names to certain IP addresses i.e. to 'resolve' them. For example, the hosts file made sure that the computer knew what IP address was meant by www.ionos.com. Therefore, the hosts file used to contain a long list of these hosts and their special addresses. The influence of the term 'host' is still noticeable today when you speak of 'hosting a website'.
If you open your own hosts file, you’ll most likely not find any entries. For the resolution of web addresses, the domain name system (DNS) is used. However, the hosts file is still practical for local (LAN) and virtual (VLAN) networks. For surfing the internet, the file is useful for blocking malicious websites, among other things.