Initially, the benefit was that people paid all medical expenses out of pocket and could purchase insurance in case of extreme medical issues.
Businesses started offering health insurance as a perk to attract employees and would negotiate a group rate. This benefits the business by both helping to attract / retain employees as well as helping to keep those employees healthy.
Labor unions campaigned to have employer sponsored health insurance which lead to insurance lock-in to a business, usually on 3-5 year agreements, without the employee having any say in where they were getting their insurance from or how much it cost. In effect, this removed health insurance from the consumer market. Compounding the problem, businesses could tax deduct the cost of insurance while employees could not.
So both the cost and quality of insurance was removed from the consumer market. Insurance removes the cost of medical care from the consumer market. Federal tax deductions only for businesses incentivize this arrangement.
The problem here is not caused by capitalism.
This is also before we take into account sheer supply/demand factors around doctors and the regulatory bodies involved in the supply side.