Could have swim bladder disorder... in younger fish, this can be caused by eating too much, feeding dry pellets and/or constipation...
A young fish's digestive tract is tiny, and sometimes it gets clogged up because of its tiny size.
Epsom salt helps to get his digestive tract straightened out. Float your fishy in a container in his tank, then add conditioned water treated with Epsom salt, mixed 1tsp/gal (pre-mix in bucket - make sure the salts are totally disolved and the water temp matches the tank) with 100% water changes for a couple days. No food!
Watch for poop and for the betta to be able to keep itself upright. Then you can return him to his tank. Restart food (soak pellets in tank water first before feeding) in smaller quantities (1 or two pellets a day).
I used this on one of my young betta girls who have sbd and was floating tail up! She recovered in a couple of days.
Any additional questions, feel free to ask. ;)