Many things in software are misnomers.
Personally, I think it’s an amazing name. The first time I saw the term, I knew exactly what it was without any further research.
You shake a tree to remove the loose things. In this case, it was clear that unused packages are being “shaken” from the tree.