Docker Swarm or Kubernetes

There has been this narrative that you don’t need to use Kubernetes for every project, which I agree with and I feel like sometimes Docker and Docker Compose are more than enough, depending on what you're trying to achieve.
Something else I’ve been thinking about is how, over time, Kubernetes has gained so much attention that tools like Docker Swarm don’t get talked about as much anymore. I get the impression that quite a number of people, and I’m sure more than half in this training program have heard of Docker Swarm but haven’t really explored it deeply, even though it has a simpler learning curve compared to Kubernetes and can handle a good number of orchestration tasks.
This makes me wonder, why did Kubernetes gain so much popularity that it largely overshadowed Docker Swarm, even though Swarm can achieve many similar outcomes and is built directly into the Docker ecosystem?

Would be interesting to hear from anyone who has used both in practice — what made you choose one over the other?