Why do AI civilizations suddenly become rich in Civilization 6?

Azteks suddenly got very rich around turn 300. What could be the reason? Can I find it out using debug panel if I have saves for around that turn? Played on king difficulty.

enter image description here


It sold a bunch of units and/or buildings

Since all that gold appeared in one turn and no other civilization had that much (or in deed any collection of civs) we can rule out trade. It's not natural production either, the curve is too steep for that (comparing to how steep it is for natural production before and after the sudden increase). That leaves one thing that the AI could do (aside from cheating, which it does do on king by the way), selling stuff.

There's a bug in civilization VI where certain civilizations and civics increase the gold price of selling units so that limitless gold is obtainable by selling and buying units (as the sale price becomes higher than the buy price). This also means the actual gold gained by selling things can become very high later in the game.

While I don't think the AI actually actively exploits it, it may value its existing units as gold. It may decide to sell units it bought much earlier in the game that are now obsolete for a large lump sum of gold, to use to trade with the player or other AIs.