Thank you for posting your query on Microsoft Q&A. From above description I could understand that you are trying to add guest user to M365 group via Sharepoint site invitation.
Please do correct me if this is not the case by responding in the comments section.
As per Invite users for SharePoint collaboration Site access is controlled through the associated Microsoft 365 group and guests can't be added to the Microsoft 365 group from the site. For information about how to add guest to a group.
Kindly follow see Adding guests to Microsoft 365 Groups to add users to M365 groups.
Thanks,
Akshay Kaushik
Please "Accept the answer" (Yes), and share your feedback if the suggestion answers you’re your query. This will help us and others in the community as well.