A homeowners association is is comprised of two elements: Common Property and Deed Restrictions.
Common Property: property that is owned by all homeowners
Deed Restrictions: restrictions on the use of the land
You can have one without the other. An association in a historic district, for example, may have deed restrictions regarding the appearance of homes, but not own any property.
Deed restrictions have been around since the inception of organized neighborhoods. But the modern HOA that you most commmonly see today has its origins in the 1970’s Clean Water Act. This law required new developments to have a stormwater management plan which in turn required the creation of retention or detention ponds and drainage areas.
If City governments are unwilling to take ownership and maintenance responsibility and liability for these areas, a private entity must do so. Land cannot merely exist in America. Someone has to pay taxes on it, mow the grass that grows on it, pick up the trash that falls on it, insure it in case someone trips and falls on it. In an HOA, the common land is jointly owned by all the homeowners. But the maintenance and liability of that land can't be divided into slivers for each homeowner. Instead, a corporate entity is created, that represents all the homeowners, jointly. When you purchase a home in an HOA you become a member of that corporation.
The corporate shell created by the HOA facilitates maintenance of the common properties and enforcement of the deed restrictions, as well as protecting individual homeowners from liability.