It isn’t possible to simply change the name of an existing team site or tenant because of how the architecture works for Office 365 team sites.
For example, you cannot change:
contoso.sharepoint.com to fourthcoffee.sharepoint.com
https://contoso.sharepoint.com/sites/sample1 to https://contoso.sharepoint.com/sites/sample2
Workaround: change the domain of a team site
If you must change the domain of a team site (for example, change contoso.sharepoint.com to fourthcoffee.sharepoint.com) you will need to do the following:
Create a new Office 365 account and use the name that you want to use for the onmicrosoft.com domain as part of sign up.
(Optional) Remove your custom domain from the original account (the one with the team site name that you didn't want).
(Optional) Move any email, files, or other data you may have set up with that account to the new one.
Workaround: change the name of a site
To change the name of a site, for example, from https://contoso.sharepoint.com/sites/sample1 to https://contoso.sharepoint.com/sites/sample2, you need to create a new site and then move all the content from the old site to the new one. Follow the steps in this this KB article.