try isolating him, first of all. Then feed him frozen peas. My roommate's goldfish had this same problem because pellets expand when they soak up water. Fish eat them, they can get caught in their swim bladder, expand, and screw up their abilty to swim in the right diretion. I would look up swim bladder diseases, but I have heard that feeding them frozen peas helps them stay upright and can cure the problem. There is a specific way to feed them to fix it, so you really should look it up.
Isaac