I would point to a few key reasons for the complexity.

1) Value based care - It used to be simpler with a model called fee for service. Get paid for what you provide. Insurers, Medicare in particular, aggressively drove the industry away from that because they argued it incentivized unnecessary care. The general approach now is value based care, where the insurers and providers negotiate a rate for each type of procedure or case, usually quoted as a percentage of the Medicare rate. In practice, that means that hospitals don't get paid for what they did, they get paid for the problem they solved, regardless of what it took to solve it. I'm oversimplifying, as this all depends on the setting for the care and the contract specifics, but this is certainly a major factor in how things got so complicated.

2) Supporting documentation - To combat fraud, insurers require that an appropriately licensed clinician provide medical documentation supporting the problem's conclusion. The insurers actually check for compliance, i.e. that the notes support the conclusion, in a significant number of instances. In response, the provider side of the industry has instituted expensive software (Epic, Cerner) and employs an army of clerical workers to be prepared to respond to audits from payers. These audits come in many forms, the most common is a denial where the payer essentially calls bullshit on a single claim, and the providers have to cough up detailed justification to get paid. Many providers find responding to denials so onerous that they don't even try, they just eat the loss. You can't do that in isolation though, that expected loss gets baked into the prices over time. And now you've got your most highly trained, value add people in the industry, doing data entry, by the way.

3) silos of information and decision making - The hospital cannot definitely tell you what you will pay out of pocket. They may be able to tell you the negotiated rate they have with your payer for a specific service, but they do not know if you will have met your annual deductible by the time you are billed. Your insurer has that information, not the hospital or the doctor's office. Your doctor is also not likely to know the complex billing logic, so even if they could tell you what they typically write in their notes for what they intend to do to you, you would still have a few steps before you could figure out what's likely to be billed (because it has to be converted to billing syntax). You may also know things that would affect the billing decisions that your provider doesn't know yet. If you're going to have a procedure and you've got diabetes, for example, your case might be considered complicated and command a higher rate. The list of complicating diagnoses is long. That's one reason you usually get labs done before a procedure. The provider needs to know what they're dealing with and that information can affect how much you and your insurer will ultimately pay.

Each of these factors complicate the billing logic. They all exist for good reasons. You don't want call center workers diagnosing patients and telling them how much things are going to cost. You don't want providers performing unnecessary procedures to drive up billings. Insurers have found that well intentioned providers are often sloppy with their notes or outright unethical with their billing practices. If the insurers can catch those mistakes, they can deny payment, and make more money, some of which will be used to keep premiums lower.

It all exists for a reason but put it together and you've got a damn mess and no one's happy.