This post is more related to EM markets, rather than developed markets (so could add some additional examples, to the already good DM examples given by @math above):
(i) In some countries (for example CZK prior to 2019), the Ministry of Finance preferred to issue shorter-dated bonds (up to 5 years), and there was less issuance of longer-dated bonds. As a result, pension funds and other type of funds, who wanted to go long duration, had no other choice but to receive longer-dated swaps. This caused the Swap curve to be "permanently" inverted from the 5y point up to the 10y point: it was just a "technical" flow problem.
(ii) The ECB has consistently failed to hit its inflation targets for the past decade. This has made the markets skeptical about inflation expectations in Europe (not just the Eurozone), and the markets tended to price in rate cuts for any sovereign European swap curves, where the central bank's policy diverged from the ECB policy of low rates (again, you could see this for example on the CZK curve, prior to the Covid19-driven change in CNB's policy).
(iii) During any risk-off scenario, fast money tends to receive emerging market swap rates between the 5y up to the 10y pillar (rather than receiving the short end): this can also make the curve inverted, whenever there is a flight-to-safety and at the same time the local central bank's rates are relatively high (which anchors the short-end of the curve)