DNS acts like a phone book that maps names to addresses. Your machine asks a resolver, usually run by your ISP or a public service. The resolver checks its cache first. On a miss it walks the name hierarchy from the top.
It asks a root server, which points to the top-level domain server for .com. That points to the authoritative server for the domain. The authoritative server returns the actual IP address. The resolver hands that back to your program.
This lookup happens before any real request, so it sits on the critical path. A cold lookup can add tens of milliseconds. Caching along the way keeps most lookups fast.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.