Browsers ship with a list of trusted authorities. A certificate signed by one of them is accepted; a self-signed certificate is not. Let’s Encrypt is a free certificate authority.
Certificate authority
An organisation trusted by browsers to issue SSL/TLS certificates after checking who controls a domain.