system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How can shelf stable milk be kept at room temperature for months without going bad?
gpt
Milk spoils because microorganisms start eating it & exposure to oxygen in the air air causes it to break down.  Refrigeration just slows down the growth of microorganisms & the chemical reactions - it doesn't stop them completely.

Shelf-stable milk will be pasteurized at super high temperatures - this kills all the microorganisms rather than just "most" of them like regular pasteurization would.  It's then sealed in a package that prevents any air or new microorganisms from getting inside to start the spoiling.

As soon as you open it, however, it's going to spoil about as quickly as regular milk.