Well, technically both are valid approaches which get messages from one user to another in a federated way. Besides that, XMPP is an IETF standard which has proven it can adapt to changing requirements. Matrix, on the other hand, is a young project with more momentum and more consistent software landscape.
That said, I have quite a biased view on the topic, as I kinda blame the Matrix devs for splitting the federated communication community. XMPP is quite capable of delivering what everyone expects it to do. But lately, developers seem to be more interested in the new Matrix protocol (just because it is new). At the same time, many XMPP clients do not implement all of the latest features the standard has to offer and I wonder what the world would look like if the Matrix devs would have spent their energy on improving existing XMPP clients instead of inventing another protocol.
That said, I have quite a biased view on the topic, as I kinda blame the Matrix devs for splitting the federated communication community. XMPP is quite capable of delivering what everyone expects it to do. But lately, developers seem to be more interested in the new Matrix protocol (just because it is new). At the same time, many XMPP clients do not implement all of the latest features the standard has to offer and I wonder what the world would look like if the Matrix devs would have spent their energy on improving existing XMPP clients instead of inventing another protocol.
Edit: For completeness, you might like to take a look at the Matrix FAQ https://matrix.org/docs/guides/faq.html#what-is-the-differen...