Why? DOJ is an Executive branch department.
Should Trump shut the $^^_$$ up about HUD, etc.?
That would be a valid point, but unlike any other executive branch department, the U.S. Justice Department routinely prosecutes cases under the oversight of another Federal branch of government (the Judiciary). This means the U.S. Attorney General should not conduct himself the same way an ordinary political appointee like the HUD Secretary or Defense Secretary does.
Even a mere perception of political involvement in court cases can completely undermine the prosecution of those cases. President Trump does his AG -- and himself -- no favors by posting public rants about active cases.
And it's worth noting that the term "active cases" is critical here ... because that's really the only thing AG Barr is complaining about.