Almost the same question can be observed at dictionary.com. It responds to the question as:
A collective noun refers to a whole group as a single entity but also
to the members of that group.
A collective noun names a group of individuals or things with a
singular form. Examples of collective nouns are: faculty, herd, team.
There are collective nouns for people, animals, objects, and concepts.
The use of a singular or plural verb depends on the context of the
sentence. If one is referring to the whole group as a single entity,
then the singular verb is best: The school board has called a special
session. When a group noun is used with a singular determiner (e.g.,
a/an, each, every, this, that), singular verbs and pronouns are
normal: The team is away this weekend; they have a good chance of
winning. There are other contexts where the plural verb is more
natural: My family are always fighting among themselves. When the
individuals in the collection or group receive the emphasis, the
plural verb is acceptable. Generally, however, in American English,
collective nouns take singular verbs. In British English, collective
nouns are more often treated as plurals that take plural verbs.
I think there are still some debates on the topic, however.
So, when you refer to department as "them", you are actually refering to the people who work in that department, not the department itself.