Impermanent loss happens when the price ratio of deposited tokens changes after you deposited them in the pool. The larger the change is, the bigger the impermanent loss. This is why AMMs work best with token pairs that have a similar value, such as stablecoins or wrapped tokens. If the price ratio between the pair remains in a relatively small range, impermanent loss is also negligible.
With that said, impermanent loss isn’t a great way to name this phenomenon. “Impermanence” assumes that if the assets revert to the prices where they were originally deposited, the losses are mitigated. However, if you withdraw your funds at a different price ratio than when you deposited them, the losses are very much permanent. In some cases, the trading fees might mitigate the losses, but it’s still important to consider the risks.