TWR vs XIRR: two different questions, two different answers
They can both be correct about the same account and still not agree, because they aren't answering the same question.
Two questions that sound like one
“What return did my portfolio make?” is really two different questions wearing one sentence. “How well did the investments themselves do, regardless of when I happened to add money?” is time-weighted return (TWR). “Given when I actually put money in and took it out, how well did my money do?” is money-weighted return — in practice, XIRR, the version that handles deposits and withdrawals landing on irregular dates. Both are real answers. They just aren't answers to the same question, which is why they can point in different directions on the very same account.
A worked example
€10,000 goes in on 1 January. By 30 June it's worth €11,000 — a 10% gain for the first half of the year. On 30 June, right before a rough patch, another €40,000 goes in, so the account is worth €51,000 the moment it lands. By 31 December the account is worth €48,450 — a 5% loss on that €51,000 for the second half.
TWR chains the two halves together and ignores the size of the deposit between them: 1.10 × 0.95 − 1 = 4.5%. By that measure, the year was a modest, genuine gain — which it was, for the money that was in the account the whole time.
XIRR sees it differently, because it can't ignore the deposit: it asks what constant annual rate makes −€10,000 on 1 January, −€40,000 on 30 June and +€48,450 on 31 December balance to zero. Solve that and the answer comes out negative — roughly −5% — because four-fifths of the money that ever went in was only exposed to the account for the losing half of the year. Same account, same two numbers on the statement, and the two returns don't just differ, they have opposite signs.
Which one you actually want
Judging an investment, a strategy or an index fund on its own merits: TWR. It's what fund fact sheets quote, because a fund manager doesn't control when investors buy in.
Judging how your own money actually did, deposit timing and all: XIRR. It's the honest answer to “was topping up when I did a good idea?” — which TWR is built to not answer.
Comparing yourself to an index fairly needs a third step on top of either one: see the DeGiro vs the S&P 500 guide for why a raw index return isn't the right thing to compare against.
Further reading
Both are special cases of the broader idea of a rate of return; XIRR itself is Excel's name for solving an internal rate of return for cash flows on irregular dates. Wikipedia's rate of return article covers the general case both are drawn from.