During World War II, the United States (US) instituted wage and price controls. To attract better employees, companies would offer benefits to get around salary limits. Health insurance was one of the more successful benefits.
At that time, income taxes were newer and there were many ways to evade them. Companies could generally deduct expenses. So at that time, health care was deductible because everything was. And at that time, only wages were taxable compensation from employer to employee.
Since that time, many other benefits have become non-deductible for employers, e.g. housing or the reduced deduction for meals and entertainment. But health care is generally regarded as different, as a necessity. While everyone needs to eat, not everyone needs to eat at a $100 a meal restaurant. People who need expensive health care really need it. People who eat expensive food just prefer it.
And of course, health care is more intermittent where food is relatively consistent. You don't need ten thousand calories one day and zero the next. But some families have no health care expenses in a year while another might have cancer or a pregnancy. Note that medical care expenses can be deducted for individuals if they are large enough in aggregate and you itemize.
And of course both businesses and workers have incentives to maintain the current system with deductibility. Health insurance is a common benefit. Housing is not (although it's worth noting that travel housing and meals are deductible). So there have been few people impacted by making housing taxable while many people would be impacted by taxable health insurance.
You can deduct health insurance costs if self-employed. It's also not true that health insurance is the only benefit with preferential tax treatment. Retirement and child care are also deductible. Even meals and housing can be deducted in certain circumstances. The complex rules about what and how much is deductible.
There have been rumbles about normalizing the tax treatment of health insurance and medical care, but there is a lot of opposition. Insurance companies oppose making all healthcare expenses deductible, as that reduces their effective benefit. They would prefer only insurance premiums be deductible. Traditionally employed individuals oppose making health insurance taxable, as that would increase their taxes. So the situation persists. There isn't quite enough support to move in either direction, although the current compromise is economically silly.