The purpose of HR in any company is to protect the company and its interests. Management within a company are the proxies for a company, therefore HR protects manager misconduct to protect the company.
This was taken from another thread where it was posted as a reply, PostID:@XuqMNxI-ygc . Frankly, I was surprised that people are debating the role of HR and whose interests it protects. Thought that was understood. In any case, this guy summed it up well in these two sentences.