The goal is to have our local dns resolution resolves to localhost any host name ended by certain tld (top level domain), e.g. if we want to use *.loc as tld, then example.loc should resolve to localhost, as well as any hostname ending by .loc.
This is very convenient for local development, having the chance to use different host names resolving localhost without the need of setting them up individually.
Ubuntu, as of version 20.04, uses systemd-resolved as name resolution service, and NetworkManager to handle pretty much everything related to connectivity. NetworkManager includes dnsmasq which in the past used to be enabled by default, but as now name resolution is handled by systemd-resolved, is disabled by default.