You can execute the following command to allow guest users to chat:
Set-CsTeamsGuestMessagingConfiguration -AllowUserChat $True
Before you start, installing the Teams PowerShell module. Then, connect using an admin credentials. For more details, please refer tot this article: https://learn.microsoft.com/en-us/microsoft-365/enterprise/manage-skype-for-business-online-with-microsoft-365-powershell?view=o365-worldwide.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.