system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: What's a homeowners association, how is it legal, and why can't you just ignore their rules and live however you want in your own home?
gpt
It's an agreement between all the homeowners in a particular area to abide by common rules, and sometimes includes maintenance of common spaces. 

It's legal because it's part of the contract you sign when you purchase the house. If you do not like the rules you should not purchase the house. 

Like any contract, they can take you to court for breaching it. The HOA rules may also include rules about how to settle disputes. 

Basically, it's not just your house...when you bought it it came with some communal obligations.