Office 365 creates a domain for you, like contoso.onmicrosoft.com, when you sign up with the service. The user ID that you create when you sign up includes the domain, like email@example.com.
Typically people use the initial domain while they’re using a trial version, to try out the services or while they're getting things set up. You can continue to use the onmicrosoft.com as long as you like; it'll still work for email and other services, even if you add a custom domain. But most people add their own domain, like fourthcoffee.com, to Office 365 before they start using Office 365 for their organization so they can use a friendly, memorable email address and user ID with the service.
You may have two initial domains: onmicrosoft.com and public.sharepoint.com
If you have a SharePoint Online Public Website, your Office 365 subscription may actually have two initial domains: the onmicrosoft.com domain, that you chose when you signed up, and a SharePoint Online domain for your Public Website, created automatically for you.
You can use your onmicrosoft.com domain (like fourthcoffee.onmicrosoft.com) with most Office 365 services. For example, you can use the onmicrosoft.com domain with Office 365 email addresses (they are also your user IDs for Office 365), team sites, and Skype for Business Online.
If you have a SharePoint Online Public Website (no longer available with new subscriptions), it's hosted on your initial SharePoint Online domain, like fourthcoffee-public.sharepoint.com.
Note: Many organizations already have a website outside Office 365 that uses their custom domain name. If this is true for you, you don't need to consider the public.sharepoint.com domain.
Using your own domain instead of the initial domains
When people are ready to use Office 365 for their business, most would rather have email that includes their own domain, like firstname.lastname@example.org. To get started, see Add your users and domain to Office 365.
To be clear, you don't have to add your own domain. You can keep using the onmicrosoft.com domain with Office 365 and never switch. But using your own domain lets you have an easy-to-remember Office 365 email address (it’s also your user ID). If you have a SharePoint Online Public Website, adding a custom domain lets you use it as a website URL for your business.
Let's say you decide to add your custom domain to Office 365. (If you don't own a domain name, you can easily buy one in Office 365.) After you finish, when you look in your list of domains in Office 365, the domain you added is included, like fourthcoffee.com. The initial domain is there, too (the one that includes onmicrosoft.com).
You can use your custom domain for several things in Office 365. For example:
Use your own domain with email addresses. You can change users’ email addresses to use the more familiar domain name. When you change your email to Office 365, by updating your domain's MX record in the next step, ALL email sent to that domain will start coming to Office 365. If other people use your domain for email, you must set up Office 365 mailboxes for each of those people.
Use your own domain with your public website.
If you already have a website hosted somewhere else, you can set up your custom domain in Office 365 so your website continues to work where it is.
If you're using a SharePoint Online Public Website, you can set up your SharePoint Online Public Website to use your custom domain.
Renaming or removing the onmicrosoft.com domain
There are some limitations about the initial onmicrosoft.com domain.
You can’t rename the onmicrosoft domain after sign-up. For example, if the initial domain you chose was fourthcoffee.onmicrosoft.com, you can’t change it to be fabrikam.onmicrosoft.com. To use a different onmicrosoft.com domain, you’d have to start a new subscription with Office 365.
You can’t rename your team site URL. Your team site URL is based on your onmicrosoft.com domain name, and because of the way SharePoint Online architecture works, unfortunately you can't rename the team site.
You can't remove your onmicrosoft domain.Office 365 needs to keep it around because it's used behind the scenes for your subscription. But you don’t have to use the domain yourself after you’ve added a custom domain.
However, if you like, you can keep using the initial onmicrosoft.com domain even after you add your domain. It still works for email and other services, so it's your choice.