I would suggest soaking the pellets in tank water (in a separate container) for about 15 minutes and then try feeding it to him. You could also try gently tapping on the water where the food is, to mimic a bug.
I would still get a filter and heater for your 2.5 gallon tank. Bettas thrive in 78°F-80°F and maybe he’s refusing to eat because it’s too cold. Your tank not being cycled could be another problem. How often do you do
water changes? How much water do you change?
He might of ate the algae because he’s hungry. My betta will eat anything that will fit in his mouth lol. Try feeding him again. Maybe this time he’ll eat
Since you got him a month ago, he could just be farting used to his new tank and the food. Do you have a picture of him and his tank?