honi that's the reason. Some breeds were bred as guard dogs or for fighting and so the tail was cut off to stop it being held or bitten (e.g Boxer); some gundogs had them docked lest the animal caught it in brambles and thorn thickets, and so suffered (English cocker spaniel); some had them docked for purely cosmetic reasons or fashion (Australian silky terrier and many other small breeds). Poodles are a questionable case. They were bred to retrieve ducks in hunting and may have been docked for practical reasons; it may, conceivably, help their swimming, just as the poodle clip was designed to do; but like the clip it was surely done later simply for the look.
In the US the ears of some breeds are cut back; this, historically, was for fighting dogs, to deprive the opponent of an ear to bite and hold or tear off. This practice has been illegal in the UK for a hundred years (and is disapproved of by American vets)
There is no reason to dock the tail of pet dogs. In fact there is no reason to do it to any dog ; even the few gundogs that are docked breeds are losing their tails to prevent hurt to the tail, which is like cutting off a leg to prevent the future risk of a broken toe

Vets in the UK are forbidden, by their professional body, to dock any tail, whatever the breed, except in the case of medical necessity. Their professional body describes it as 'unacceptable mutilation'.
At Cruft's and most other big shows in the UK most of the exhibited dogs from 'docked' breeds are still docked, nonetheless; I've yet to see an American cocker spaniel exhibited uncut. It's now illegal for it to be done by the breeder( only a veterinary surgeon may do it) but few doubt that some breeders do do it themselves . There are still vets around who will do it on the sly, too.