Why so many package manager?

As I am study more and more about web dev, I encounter many many “packages”, “libraries”, “package tools”, “cli tools”, etc. I also noticed that they all try to solve the same problem more or less, but differently at the same time.

What are the advantages of having so many of these packages doing the same thing?
For instance npm | brew | chocolatey | yarn

Homebrew and chocolatey serve different platforms. Yarn was created back when npm was intolerably slow, and provided the impetus for npm to actually improve. RPM’s multi-arch support prompted apt to do the same. Competition is good.

A Grand Unified Package Manager has been a dream since, well, people started using packages. Don’t hold your breath. I suppose Nix counts as such, but that’s more a “build the entire system” sort of thing. Docker might be the closest practical thing now by making package management basically irrelevant to the host system.