Historically, they had much larger beaks (they were extremely large birds (20–30”) in earlier millennia, only in recent history have they been bred to their current size of 8–10”).
Farmers decided to raise mocking birds so that they could harvest their beaks and use the beaks as small shovels. Specifically, the beaks were used for cleaning out horse stalls (of horse manure and other debris). In the days before shovels were plentiful, the stalls still needed to be cleaned or the horse could catch all sorts of disease.
As I’m sure you know, cleaning out a horse stall is called “mucking” (as in, mucking out a stall). Birds that had been raised for their beaks (then called mucking beaks), were called “mucking birds”.
At some point about 150 years ago, the Audubon Society protested that “mucking bird” was insulting and rude to that species, and they lobbied for a more polite, less earthy name. Hence the new name “mocking bird”.