A very simple example is using Armor of Agathys: Gain 5 temp hp and deal 5 cold damage to a creature while you have these temp HP. You deal damage when you take 1 or 2 hits, but after that your temp HP runs out.
If temp HP is allowed to stack, in your example you can have 29 temp HP. Thus you deal 5 cold damage when you're hit the first time...and the second...and the third...and the fourth...etc. It turns a simple 1st-level spell into a much more powerful version.
This is just one example. I'm sure there are many more examples that are even more game-breaking.