The creation of www goes all the way back to 1989 and actually stands for “World Wide Web”. using www to access a website with a browser is actually a small part of the bigger URL or “Uniform Resource Locator”, for Facebook it would look like: http://facebook.com. What happens when you use facebook.com in a web browser? If you try, you’ll see that your forwarded to http://www.facebook.com anyway.
All the work that happens is actually located in the DNS (Domain Naming System) that translates the text into a number (IP Address) that allows your computer to find Facebook.com. In the DNS its very simple to ensure sites work without www.