Traditionally, SharePoint permissions have been managed through a set of permissions groups within a site (Owners, Members, Visitors, etc.).
In SharePoint Online, this remains true for some types of sites, but additional options are available for team sites.
When you create a team site in SharePoint Online, office 365 group is created with it. And this office 365 group is added to your SharePoint Site Members group.
When you create a team site and whenever you are adding any user to the SharePoint site from modern experience, the users will be added to an Office 365 group (Group added inside your SharePoint Site Members group) and not directly from SharePoint groups.
By default, each SharePoint team site is part of an Office 365 group. An Office 365 group is a single permissions group that is associated with various Office 365 services. This includes a SharePoint site, an instance of Planner, a mailbox, a shared calendar, and others.
When you add owners or members to the Office 365 group, they're given access to the SharePoint site along with the other group-connected services. Group owners become site owners, and group members become site members.
It's possible to manage SharePoint site permissions separately from the Office 365 group by using SharePoint groups, but we recommend against it. In such a case, group members will continue to have access to the site, but users added directly to the site won't have access to any of the group services. The exception is view-only access - Office 365 groups don't have a visitors permission for view-only access, so any users you wish to have view permissions on the site must be added directly to the visitors group on the site.
Source: Sharing and permissions in the SharePoint modern experience.
Read more related information at: The SharePoint Permissions Struggles in Office 365 Groups.