A certificate lists exactly which hostnames it is valid for. This error means the address in your address bar is not on that list: the certificate was issued for a different name. The classic case is a site whose certificate covers the bare domain but not www (or the reverse). Less benignly, it is also what an intercepting hotspot or a wrong DNS answer looks like, so context matters.
www.example.com fails, try example.com, and vice versa. Sites that misconfigure one variant usually serve a correct certificate on the other.For site operators: issue the certificate for every hostname the site answers on (bare domain and www, plus any subdomains served), or use a wildcard or multi-name certificate, and confirm the server presents the right certificate for each name (SNI). Visitors cannot patch a name list that omits them.
What name is the certificate supposed to match? The exact hostname in the address bar. Certificates list valid names in their Subject Alternative Name field; modern Chrome ignores the old Common Name field entirely, so a certificate whose SAN list omits the visited hostname fails even if its CN looks right.
Can DNS cause a name mismatch error? Yes. If DNS points the name at the wrong server (a stale record, a hijacked resolver, a hotel portal), the server that answers presents its own certificate for its own names. The browser is reporting accurately that whoever answered is not provably the site.