Can I buy domain from GoDaddy and host elsewhere?

The domain is independent of hosting your website. So you can buy a domain at GoDaddy and host at the different provider.

What you will need from your host are nameservers. Then you simply add nameservers addresses inside domain management and domain will point to your new web hosting. Usually, nameservers are shown inside your Cpanel account.

Example Hostgator c-panel:

How you can add custom nameservers for a domain registered with GoDaddy you can check on the official website tutorial GoDaddy add custom nameservers

After updating nameservers your domain will point to a new server after 24 hours. It takes about 24 hours that DNS servers are updated.