These days, most hosting companies offer a free domain name when you purchase a hosting package with them. But, there are a few reasons you might want to buy a domain name separately from your hosting package.
Your domain name plays a big part in establishing your identity on the web so you want to keep it secure.
When you get a free domain through your hosting provider, they own the domain name, not you. If a time ever came that you wanted to change hosting providers, it could be a bit tricky to gain control back of your domain. I've never experienced any major snags, (like losing a domain name), but it's still good practice to separate the two.
Typically, if you change hosting companies and would like to keep your domain, you are charged a fee (around $25). To unlock the domain, you will typically need to wait about 60 days, then contact the hosting company and pay a fee.
One advantage to purchasing your domain separately is if you know you're going to need a website, but aren't ready yet, you can wait to purchase hosting until you're ready.
Watch
How To Register Your Own Domain Name.