"Department of" or "Department for"

I don't think there is a clear answer to this, but my feeling is that "for" is used when the department supports that thing.

For example: "The Department of Education" sounds like something that does the educating (and actually sounds like an Orwellian euphemism for somewhere troublemakers are sent, to return only as broken people), but they actually support (or at least are supposed to support) the process of education, which is actually done in schools, largely. So, "The Department for Education" makes more sense.

This is the list of UK government departments: there are 8 "Department for", and only one "Department of", the Department of Health and Social Care.

https://www.gov.uk/government/organisations

That last example actually gives lie to my own theory, since the relationship of the department to the issues of health and social care is presumably analogous to the relationship between the Department For Education and the issue of education itself.

It may simply be the case that "Department Of" is the older version, and over the years the departments have changed their name to the more supportive-sounding "Department For", and the Department Of Health And Social Care is simply the straggler in this process. As with any change, there may be people who resist the change, seeing it as pointless, and so maybe someone at the DOHSC resisted a proposed name change. Or it might just be an accident of history.

Looking at https://en.wikipedia.org/wiki/Department_for_Education, it appears to have changed its name, and was the "Department of Education and Science" at one point, so I think my "slow migration from 'of' to 'for'" theory has some merit.