www.example.com is a subdomain of example.com. Just like foo.example.com or bar.example.com. Many domains direct their www subdomain to their base domain and vice versa using DNS, but they can resolve to different IP addresses.
www was just a convention for notating that the server was for a website on the “world wide web”. As opposed to mail.example.com being for an email server or ftp.example.com being for a File Transfer Protocol server.
BananaTrifleViolin@piefed.world 1 hour ago
Because it used to matter more. As other have said “ftp.domain.extension” was for FTP, mail for mail, and www for websites but that has long been somewhat redundant, as the servers at a domain redirect connections to the right place. mail.domain.extension was originally exclusively for mail servers themselves, but lots of websites long ago made it also valid for landing pages for web interfaces for their mail service if a request comes in via http.
WWW was certainly a very useful concept when people were getting used to the internet. A lot of people had no concept of computers and domains, so to say “www.domain.extension” was clear to people “this is the website for your browser”. And when you say www it’s very clear you’re telling someone it’s a website; that is helpful when say your audience my include elderly people who never got used to computers.
Also the redirection of connections is so simple now, that specifying WWW is generally just not needed. WWW is still the basic landing place for many web sites, but if you don’t include it the servers at the domain will very likely direct you on to the right place, and if they don’t your browser will often try again by appending www anyway and retrying to see if it reaches a valid webpage. So now we just don’t need to tell people “you need to include www”.