Related to domain

I want to know is it necessary to buy a domain can’t we get it for free cuz on Wix if you want to publish your website you have to link your domain on that platform