When webpages new, it was convention to use the subdomain for web traffic. Technically you can still set up your site and make www.mydomain.com different from domain.com, but pretty much everyone just makes one their primary site and then redirects the other one. So you set up www.mydomain.com to redirect to mydomain.com and just use that one for your main site, or vice versa.
Anything in front of the . is a subdomain: “subdomain.domain.com”.
When webpages new, it was convention to use the subdomain for web traffic. Technically you can still set up your site and make www.mydomain.com different from domain.com, but pretty much everyone just makes one their primary site and then redirects the other one. So you set up www.mydomain.com to redirect to mydomain.com and just use that one for your main site, or vice versa.