A quick question which I have been unable to find an answer to. When you get a question like this you think, This is a golden opportunity to brighten up scientists' dull lives. I sent urgent inquiries all over the globe. Fish flatulence has not been a major focus of biological research, so the following is somewhat tentative.
Many fish have a swim bladder that they inflate or deflate as necessary to maintain buoyancy.
Usually any expelled gas exits from the mouth and would properly be considered a burp. However, the sand tiger shark, Carcharias taurus , gulps air into its stomach at the surface, then discharges it out the back door to attain the desired depth. Surely this qualifies as flatulence in the common sense of the term. We then get into a somewhat speculative realm. In theory any animal's metabolism produces carbon dioxide, while bacteria in the gut produce methane.