You've learned one of the most important lessons in the corporate world:
HR is not your friend
One of the main purposes of an HR department is to protect the company from its employees, not the other way around. I'm not suggesting that HR is necessarily adversarial with the employees or that they're against the employees at all. But they are going to be loyal only to the company. That's why they exist.
One common failing (and I used to have it as well) is that we believe that HR is somehow there to protect us. It's normal to think that because it's what we're always told during onboarding and in handbooks, etc. We're told repeatedly that we can always talk to HR if we have a problem with our supervisor. Sometimes it's even implied (though rarely actually stated) that talking to HR will be held as confidential. That's simply a lie.
What HR will hold confidential is whatever it benefits the company to hold confidential. These would include allegations of fraud or sexual harassment or other discrimination. But don't think they're keeping it confidential because of something they owe you. They do it to protect the company so they can deal with nasty situations quietly and without outside interference. The only reason they don't fire you for bringing stuff up like that is because they can't anymore. Notice I said "anymore" because that used to be standard until laws stopped them.
Which brings us to your particular situation. Unless you're telling HR something that your manager or someone else has done that's illegal or a massive violation of a written policy, you can count on HR to tell everyone involved. There is no expectation of privacy with HR because HR represents the company. HR IS the company.
Look at an organizational chart. Starting at the top, follow it down to the bottom. That is the order in which people will be protected. In any dispute, you can count on HR siding with whoever is higher on that chart. Period. Don't ever think HR is your advocate, they aren't.
I'm sorry if this seems like a cynical answer but it is not. It is based on decades of experience and while I'm certain there may be some company somewhere that has HR acting as advocates or true mediators, what I'm telling you here is 30 years of experience in 100% of the cases.