The normal Portainer Agent wants the server to connect to it. That is awkward for a box behind a home router or someone else’s firewall. The Edge Agent turns it around.
With the Edge Agent, the remote machine connects out to Portainer. The docs say it polls the server for pending jobs, so you open nothing on the remote side. On the Portainer server you need the UI port 9443 and the tunnel port 8000 reachable, which is the tunnel that carries the TLS connection back.
You add one in Environments, then Add environment, then Docker Standalone and Edge Agent Standard. Portainer generates the docker run command for you to paste on the remote host. Do not retype it, because it holds the Edge key.
Two caveats from the docs. With a self-signed certificate the agent only connects when you add -e EDGE_INSECURE_POLL=1. And the default poll is every 5 seconds, which you can change under More settings. The standard Agent on port 9001 is described as the legacy option, so I would start with Edge.
Further reading: Add an Edge Agent environment, Add an Agent environment, On this site: browse and upload files inside a Docker volume from Portainer