In the US, the primary question is the nature of the premise that the person enters. If the premise is open to the public, restricting access is harder to justify. If the premise is restricted, access can be restricted pretty arbitrarily, apart from infringing on a person's property interest in the facility. A laboratory, for example, may restrict access to a specific list of people, or to a describable class of people. "A department" is a pretty big thing and generally does not describe a concrete location, but perhaps you mean "may not enter the department office" or "may not enter any of the following offices". Hallways in buildings are generally public places, unless there is a particular wing of the building where all access is restricted.
If there is good reason, a university official may prohibit a person, including a student, from entering a premise, and they can tell a specific person that they may not enter the department office. It is more a matter of university policy and not statutory law to determine who that person is that can issue a stay-out order, so it may not be the department chair – more likely, the dean or higher authority carries the real clout, on the chair's recommendation. Although in all one case that I am familiar with the person was told why, that is not a legal requirement (though the university would be forced to say why, if the person sues). A counter-consideration would be that the student has a legitimate interest in entering the premise, for example has to take an exam that takes place in a department building, has to do something in that office for job-related reasons.
It would be legally problematic to exclude a person from a public place if there is no reason (that is, the decision is completely arbitrary), because everyone enjoys equal legal protection of the right to access the public place (remember, it's a public place).