This NYTimes technical post explains it well:
The “www” is a subdomain, a specific area within the domain, but not all sites will use it. If the address works with or without the “www” prefix in the address, the site’s administrator has mapped things out so that both addresses point to the location of the server’s Web content. If the site has not been configured to automatically serve up the pages if you leave off the “www,” you usually get a message saying the site cannot be found. In that case, you need to type in the “www.”
Related: