Hello Daniel,
Every organization requires a set of functional as well as behavioral competencies in order to realize its business goals. For some organizations, the need for functional competencies might far outweigh the behavioral ones at that point of time in their growth cycle, e.g. startups. So they might decide to do away with the HR Department entirely as the most of the strategic and tactical nature of work is done by the founder members themselves and whatever transactional nature of work (eg. payroll administration, contractual hiring) is left, can easily be taken up by line managers or it could be outsourced.
However, as the same organizations grow in size and scale of operations, it only makes sense to have a dedicated department to ensure people employed are displaying the essential behaviours as desired by the organization. (e.g-> for a retail chain it could be customer responsiveness, for a consulting firm it could be problem solving intent). In other words, the HR department makes sure that individual capabilities are put to best use for meeting current and future business needs.
Attaining cohesiveness of culture and capability building in the organization are two important objectives from a long term perspective on which the organization falter if all the HR work is taken up by line managers due to increased short term result oriented approach.
Besides this, there are some highly specialized functions of HR ( e.g. employment law, compensation management) for which you would must need a dedicated HR professional.
Hope the above reasons might be of some help.