> Hm we live in structured societies in which laws are used to restrict individual liberties to protect collective ones. It's not that hard to grasp
Sure, there may be restrictions on certain things you can put on a website generally (illegal content), but I think the GP's question is about this specific case. No laws were broken, and the website is not a government venue. It is a business, which also has rights/liberties regarding what they choose to allow. For instance, if I goto a a subreddit and start talking about something completely off topic and it gets removed and I'm banned, who cares? That should be allowed.
> Because you live in a society
This might be a relevant response if you take the GP's question in the most general way possible, but applying it to this specific case it is not really adequate.
> Why do courts have the power to tell me who I must serve in my restaurant?
I don't think this really applies to the situation here. It's more like if you went into a restaurant and started acting rude (but not doing anything technically illegal) and the restaurant decided to throw you out, which is totally fine and normal to do. Also, at a restaurant you are a paying customer doing 'business' (trading money for food), whereas at Facebook it's more like you are the product. You aren't really trying to make a business transaction with Facebook.
"publish" being the key word.
If you are publishing on your own website, then you are held responsible for your own content.
But big tech claims to be platforms while acting as publishers. Facebook, YouTube, Twitter etc hide behind the disguise of "algorithms" to push content they like and throttle content they don't like. The "trending" or "for you" or "promoted" etc are all decisions made by the platforms. It's well known that the "trending" videos on YouTube or posts on Twitter are not actually organic.
When they use "algorithms", they are equivalent to publishing. Similar to how newspapers can't just publish everything. They make editorial decisions on what to publish and what not to. The "algorithms" are the editorial decisions. That makes them a publisher.
Right now, even when big tech allows something libelous to spread on their platform, lets it trend, refuse to take it down and when they get sued, they claim they are immune because they are just a platform. That's not a "platform". They acted as publishers when their fake trending algorithms let it trend.
The more accurate answer is: because the state holds the monopoly of violence and will use it against you if you don't follow its laws. Resistance will result in punishment.
The reason courts have the power to make you do as they say is that if you don't, eventually armed people will come to your home and incarcerate you. Short of an armed insurrection there's really no way to avoid this unless you're Jeff Bezos (and even then you won't get away with everything but the consequences will likely be less unpleasant).
The published terms of service were invalid because they unreasonably disadvantage the users of the network contrary to the requirements of good faith.