Matrix is an open protocol for real time communications. It is designed to work on premise and similar to email servers can interact with each other via federation. It does not only offer text based chat but also audio and video based communication.
A server is often run by using the Synapse reference implementation. The variety of client implementations is huge while Element (formerly: riot) being the most common one.
When you have a matrix account somewhere you are able to choin channels and message users on different Matrix servers. This is being done by a feature called: federation. The server and channel operators can decide if people from a different domain can join. There are also other options if for example a channel shall be invite only.
A matrix server can act as a bridge to another communications network, so you can just join Matrix and if there's an IRC bridge enabled, you can at the same time use IRC, even without an IRC client.
There are also some other additional features like bots, with which you can expand your features.