However, the HOA sets rules for the community, supposedly to benefit the community. If you (the generic 'you') lived in a townhouse, and the guy attached to you on one side painted his house bright orange and installed neon lights over his doorway (right next to yours), you might not like it.
When you sign, you agree to be bound by rules the HOA set. If you don't like them, then you have the right to petition for a change, and have the home owners vote on the change. He is allowed to fly 'a' flag... but the 20' or 14' pole was against the HOA rules. He can petition them to change the rules, or fly a flag on a pole that is within the rules. He is NOT being prevented from flying a flag.
That having been said, I am not a huge fan of HOA's, as I belong to one. In fact, just had my annual walk through of my property. I had to powerwash my porch, replace some fence rails and posts, etc. Nothing major, but I can see how it would have detracted from the curb appeal of my section of the development.