A subdomain is located before the actual domain name, subdomain.example.com. Basically a subdomain is hosted on its parent domain (in this case example.com). The domain itself is a subdomain of the TLD it belongs to (such as COM, NET, or ORG).
A good example of a subdomain would be the www part of a domain name (www.example.com). Technically, we can either choose to include it or not include it. If someone chooses to include it, it will often be for marketing purposes.
See also: WWW or non-WWW
Purpose of Subdomains
Subdomains have served a variety of purposes over the years, a main purpose is the hosting of different services, and this remain one of their uses even today.
Some websites use the www subdomain when hosting their website, while others use the bare domain (I.e. mydomain.com). Some websites might also use subdomains to host multiple versions of their website, such as an English version on the en, and a Danish version on the da subdomain.
How subdomains works
A Subdomain is the first part of the URL, found before the parent domain.