HR exists to protect the company by leaving a paper trail they can point to to burn you at a moment’s notice while projecting the idea that they care about your well-being
HR is but the legal department with a sticker smile.
Borrowing that one
It can be both too. It's entirely possible to protect a companies best interests and promote employee well-being.
HR exists exclusively for the numerous situations where the company's interests and employee well-being are in conflict. In any situation where the interests are aligned, there's nothing for HR to do - left to their own devices people will just do the thing.