Hello there,
If you want to enable chat between users from two different domains in Microsoft Teams, you need to set up external access (federation). This allows users in your organization to communicate with users in another domain.
With the external access feature in Teams, you can allow users in your organization to chat and meet with people outside the organization who are using Microsoft as an identity provider. You can configure external access with: Other Microsoft 365 organizations (chat and meetings)
Thanks,