What brand of heater? Is it preset, adjustable, or one that's constantly on?
Do you have a thermometer in the tank, is the temperature fluctuating?
What are the decorations in the tank? Can you take a picture of the tank, and a close up picture of your betta?
76 degrees is the bare minimum betta should be kept at, and they do best in temperatures between 78 and 81 degrees. If your temperature is fluctuating and dropping below 76 that may be why he's acting the way he is. Adjustable heaters are best, preset next best, and the ones that stay constantly on I wish they would stop selling. If aren't using one and can afford it, I'd get an adjustable heater. 25 watt Hydor Theo's are relatively small, reliable, and fit in most 2.5 gal tanks https://www.amazon.com/Hydor-Submers.../dp/B0006JLPG8
If your tank is on the bear side that might be contributing to his behavior, betta do best when they have lots of plants, either real, silk, or soft plastic, to explore and hide in. Bear tanks can stress them out, and some will exhibit behavior like you are seeing.
Keep an eye out for white fuzz on him, or little white specks, those are signs of fungus or ich. Also lack of appetite can indicate illness.