By default, your initial user (and other users listed as "Admins") will be in the admin group, and there's a line in /etc/sudoers on macOS reading
%admin ALL = (ALL) ALL which gives members of the admin group rights to use sudo.
macOS uses its "Open Directory" service for storing the login details of new users, not the /etc/passwd file. See man opendirectoryd on your macOS system for more information about that.