My old goldfish and I mean old had some weird swim bladder/constipation.
Basically, when it ate, in the next few hours, it is either trying to swim like swim bladder. And sometimes it looks "dead" it's floating on top and it's stomach is actually in the semi air. It kind of happened often that it found a spot in the floating plants in which it will hang out. My solution was feeding less, monitoring for any other signs and water changes. After a month, it it better and is still living till today.
So in conclusion, I believe it was constipation or swim bladder.