Matrix is a decentralised encrypted conversation store; where all conversation history gets replicated across all the participating servers/nodes. It's a bit like Git, or NNTP (Usenet) or possibly IMAP, depending on how you squint.
XMPP is a message-passing protocol; where stanzas get passed between servers/nodes. It's a bit like SMTP or SIP.
There are a bunch of other differences philosophically (Matrix is one big monolithic versioned spec; XMPP is a cloud of XEPs, etc) too.
The only similarity in the end is that you can use both to build chat systems (and you can use both to build a bunch of other things too - e.g. IOT use cases).
Another way of thinking of it is SVG versus Canvas. Or OpenGL versus a Scene Graph library (Open Inventor, or whatever that's become now). Sure you can use both to draw pretty pictures, but architecturally they couldn't be more different.