Many sites have little (real/legitimate) traffic outside of their country. Traffic from most countries also generates a lot less ad revenue per user than US or other "rich country" traffic. That means the sites have a limited motivation to allow access from other countries.
At the same time, allowing traffic from other countries may force them to deal with a lot of spam/hacking/DDoS/scraping/bot and general garbage traffic, and complying with foreign privacy laws like GDPR.
This makes it easier to just block the traffic.
This is particularly infuriating when it's a government web site and you're a citizen abroad trying to access an essential government service. (In those cases it's mostly done to avoid malicious traffic.)
US news sites often do it because they get little non-US traffic and their sites are absolutely infested with ads and trackers that they can't make GDPR compliant with any reasonable amount of effort.
On top of all the legit reasons here my former, itsy bitsy company geo blocked everything not US/Canada because our customer base was entirely US based and that wasn't changing. The only traffic we got from overseas ips was looking for vulnerabilities. So why not just block it.
Very often the copyright holders of the content have different distribution arrangements for different countries/regions. If you can get the content from some other region, then your local content provider isn't getting whatever fees/and revenue they would get from you.
Countries have different laws and regulations that companies have to adhere to if they want to sell a product or publish a website there.
Additionally, they might have bought the rights to stream a movie in one country, but not others. Offering that movie in other countries would then be a copyright violation.
Sometimes it's because of certain laws from the EU for example that they don't want to follow like the GDPR for example. Other times it's because of licensing in case of streaming services.
This is a big one. It’s a lot of work to implement GDPR and sometimes it’s easier to disallow traffic from Europe than to re-architect your back end to keep European data on European servers, allow for users to request data deletion, etc.
If the website is selling physical goods it could be to prevent having to export. That can be anything from having to deal with different laws to just plain old more work with customs and everything.
Yes, like to ship to the new UK we are supposed to register with a UK government agency, collect the customs on each shipment, and pay it to the UK government monthly/quarterly. Or...we can just not ship to the UK which is a lot easier.
Another reason could be for test market. For example, some products launch into smaller places as a test bed to see if they will be successful at a larger scale. Some websites and services start this way as well.
I think the reason might be related to the cost.
For example, ChatGPT may not be available in Iran because in order for them to use ChatGPT, OpenAI would have to implement a server in Iran's network, which could be costly.
If only 1% of the total population in Iran would pay for GPT-4, it would be impossible to make any profit.