Docker is a tool that includes a daemon that runs in the background and a client app that communicates with the daemon. The daemon runs a packaged-up program and its dependencies ("image") as basically a chroot environment using an overlay filesystem and isolated network, in a custom cgroup and namespace (basically, process space/virtual filesystem paths different from your normal user process space/filesystem).
Swarm is a (sadly) soon-to-be-abandoned way to spin up a cluster of multiple hosts with Docker daemons; don't waste your time on it. The comparable solutions are AWS ECS or [to a lesser extent] HashiCorp Nomad.
Docker Compose is a console app that takes a config file and starts multiple Docker containers, creates volumes, and configures Docker networks - on a single Docker instance, so it's only really useful for testing stuff locally that requires multiple containers running at once.