Most likely your betta is constipated. Less commonly, bacterial infections and internal parasites can also cause problems with the swim bladder. We need more information to be able to diagnose your fish's problem:
- Size of tank
- Filtration? What kind of filter?
- Any plants, decorations, tank mates?
- Water parameters: temperature, pH, ammonia, nitrite, nitrate
- Food: what kind, how often, how much?
- Your fish: what other recent changes? For example, changes in behavior, coloration, bloating, red streaks, lumps, fins clamped, etc. When did your fish start exhibiting symptoms
If your fish has swim bladder disease because it's constipated, then the cause of constipation is overfeeding, poor diet, or both. To fix constipation, get some frozen peas. Take one and let it thaw out. Remove the shell. Mash up the pea. Feed the mashed pea to your betta, then do not feed your betta for the next three days. That should clear up the blockage. In the future, do not overfeed your betta, and feed it a good diet. Bettas don't need to eat much. Just 2–3 pellets once a day is fine. Many aquarists will also skip one feeding a week and/or feed mashed peas once a week to their fish to prevent constipation. Try to get high quality pellets made especially for bettas, those by New Life Spectrum and Omega One are generally considered the best. You can also supplement your betta's diet with live/frozen foods like bloodworms, daphnia, and mysis shrimp.
If your betta shows signs of a bacterial infection or internal parasites, those are a bit trickier to treat, especially bacterial infections. If you give us more information, we can try to help you out.