I have a doubt regarding the relationship between domains inside of networks and website domains. Websites domain have to be purchased, one goes to one domain registrar, looks to see if the desired domain is available and if available it is possible to purchase the right to use it for a certain period of time. So if one is building a website and wants the website to be found as www.mycompany.com it goes there and purchases the domain mycompany.com.
Now I'm starting to study about Windows Server and Active Directory and there is the idea of domains also. As I understood, forests are security boundaries that isolates AD objects and domains are namespaces inside those forests. So the root domain is used to identify the forest.
Now I've seem people naming those domains like website domains. So for example: mycompany.com could be used. Now this raises some questions:
To use a domain in a forest one needs to purchase the right to use it at a registrar?
One needs to check the availability of the domain on the internet before using it on the forest? What happens if I use the domain mycompany.com and it is already used?
So what is the relationship between those website domains we purchase at registrars and these forest domains we use internally at a network?