Honestly, there is not much onfo to work with but...
danios are spastic as there are not enough of them to feel comfortable, and a 2.5 is cruel for that combo of fish.
Someone didn't research, or took the wrong advice of tank size and stocking.
(It is generally reccomended that betta fish do well in a 5g+ tank and with no other takemates, save a small snail or two. I am a believer in this advice but opinions vary).
No matter at this point. He is lucky to have found someone to help.
You haven't given us much to go on, though.
What condition was the water in?
I don't know what specific thing(s) are wrong with him...but he looks like he is quite unhappy. Could be a number of things, or maybe you'll have an easy time of it just getting him a bigger tank without a strong current, keep at the correct temperature, test the water to see if it meets the needs of a betta, make sure the tank is cycled, make sure you dechlorinate the water, keep it clean, add (preferably) live plants, no sharp objects, good food, quiet environment to destress him.
There may be improvement.
Then you are going to have to observe him closely and discern what other issues, if any, exsist and treat accordingly.
Bottom line...lots to learn.
He looks pooped but hey, if there are no irreparable diseases fish can recover their fins, vigor, and temperament just like any of us with the right attention and care. ♡
The poor guy looks very stressed and tired. A 2.5-gallon tank is not good for much, maybe a snail.
Betta's for a fish, have higher intelligence. This is the reason they can get stressed, but they are also very hardy. I still wonder why they are kept in small cups at the lfs. This gives people that have not learned, the impression they can live in a fishbowl. I say a ten-gallon is the smallest to keep a Betta, but again that is debatable.
I would think the best for him now is to keep him alone, no hard surfaces, and keep the water clean. But in my thinking, the water should be low enough he doesn't have to struggle to get to the surface. He needs footprint in tank size, but not deep water.
The thing I have learned about the one Betta I have is that when I give him attention, he gives it right back. He is very self-aware.