Is he eating at all? What kind of food you offering him?
Do you have heater in the tank or your room is hot and you don't need a heater?
For one gallon you need to do 2-50% and 1-100% water changes. Or you can do a few 100% water changes a week.
Is he hiding behind the rock for long time during the day? Is he swimming for long time or most of the time he is hiding?
You just bought him not sure if you change his water yet , but make sure you use water conditioner.
When you do 100% water change you need to acclimate him properly.There are many ways to do a water change and acclimate (reintroduce) your fish back into the tank. Here is a few variations that's pretty simple:
1. can have betta in the changing cup with about 15% of the water and keep adding small amount of the new water about every 5 min for about 5-6 times -this way you he will get used to the temperature
2. Note the temperature of the water.
Using a plastic cup, scoop him, along with some of his water, into the cup.
Clean out the tank. Refill with water at the SAME temp. Be sure to add the correct amount of water conditioner.
Float his cup in the tank for about 15 min. (Study during this time. If he sits longer, it's OK.)
Add a SMALL amount of NEW water to the cup. (Several tablespoons, or about 1.5 ounces.)
Let his cup float for about 10 min. (Study during this time. If he sits longer, it's OK.)
If the cup starts to fill too much, remove a SMALL amount of water from the cup. Discard it.
Repeat steps 5-7, until about an hour has passed. (If he sits longer because you're studying, that's OK.)
Gently release him into the tank.
3. To do a water change, use a little cup like a plastic solo cup - this cup must be only for him and have never been used with soap or other chems. Scoop him up in this cup (keep him in the cup about 1/4 full of water - it doesn't need to be much because he won't be in it for long) and leave him in the cup while you change his water. To do the 50% use a turkey baster - dedicated only to him that has never seen soap or chems - and drag it through the gravel and try to suck as much of the poop out as possible, in addition to 50% of the water. Use a thermometer under the running tap to get it to be the same temp as the water that is normally in his tank. When the thermometer says the flowing tap is the right temp, fill back up his tank. At this point, add the conditioner (dose for how much water you change - if you change half the water you add half gallon worth of conditioner, If you do a 100% water change dose for the full gallon change). Float his plastic cup with him in it in the new water. Slowly add a couple tablespoons of the new water into his cup every 10 minutes for at least an hour. Finally, dump him in gently but try to get as little of the old cup water back into the tank as possible. When you do the weekly 100% you will do mostly the same thing except empty his tank fully and rinse everything in it very well under warm water but never use soaps or chemicals. Once it's fully cleaned/rinsed you can refill it and repeat the cup/acclimate phase.
4. When I change the water I put him in the cup I got him in then I take everything out of the tank, rinse everything with warm tap water. Then I put everything back in the tank, fill it with dechlorinated new water, and then turn the heater on. When the tank water is the same as the cup water , then take the dirty cup water out and a little at a time and put clean tank water in the cup. After that I put the cup in the tank and he swims out.