Do I need to buy a domain from Shopify or can I buy it elsewhere? How do I connect it if I buy outside Shopify?

Do I need to buy a domain from Shopify or can I buy it elsewhere? How do I connect it if I buy outside Shopify?

It is not necessary that you have to buy from Shopify. You can buy the domain from Godaddy or Namecheap and connect it  to your shopify store. More information on how to connect it can be found here: https://help.shopify.com/en/manual/domains/add-a-domain/using-existing-domains/connecting-domains