system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5 why do fish float upside down when dead or dying? 

I've only seen goldfish do this but sometimes they did it and they were still alive and they'd swim around upside down, why?
gpt
Fish have a pocket of air called a "swim bladder" that they use to help themselves swim up and down. 

When a fish is healthy, they usually use chemical reactions to add or remove gas to the pocket, or just gulp in air and burp it out. 

When a fish is dying, it starts to lose control of the pocket and may wind up overfilling it and becoming unable to remain upright.