If he's swimming sideways, it's probably swim bladder. I would suggest fasting him for a few days... You said he's new, so he actually might not eat the first few days anyways. So don't feed him for two days, and see how that works. Watch his tank for signs of defecation - it may be easier if you remove any substrate for the time being. If he's constipated, you'll be able to tell pretty fast, and that would be a good cause for the bloating and SBD.
If there's no improvement after two or three days, take a frozen pea (from a bag of frozen peas you would buy at the grocery store) and thaw it, then remove the skin, and feed him no more than a quarter of the inside of the pea. This does not provide nutrients, as he cannot absorb anything from the pea, it is simply like eating a block of fibre. Fibre will help to strengthen his digestive system by creating resistance (in the same way you would work out with weights to strengthen your arms), and pass what has him constipated. I personally suggest about an eighth of the inside of the pea... Definitely no more than a quarter though. A good judge, is about the size of his eye. Please DO NOT use a "cooked" pea or a fresh/unfrozen pea! The frozen pea, from a bag from the grocery store, has been blanched in the processing of it (otherwise it would not even be safe for you to eat). Since blanching can easily be done incorrectly, it is safest to make sure it is from the store, where the peas have to be blanched properly in order to guarantee food safety.
I hope this helps you out a bit! But fast him first, and let us know if he gets better, I hope he does! <3