Let's start with getting some info.
What size tank he is in and is there a filter or heater?
How often and how much of the water do you change?
Are you familiar with the nitrogen cycle?
For additional reading check out the article link in my signature, good, solid info for fish keeping in general.
Best to know what the condition is of the water he is in. Do you have a test kit and have you tested to see what the water conditions are?
Looking for levels/readings for Ammonia, NitrIte, NitrAte, pH.
How long have you had this guy, and how long has this issue been going on?
~~~
What to do about it. Any issues usually call for a fresh water, so do a partial water change aka pwc.
If it has been more than a couple weeks since a pwc (and you do =not know his water parameters, then try doing 3 pwc of 1/3rd of the water, then another 1/3rd, and then maybe a couple hours later another one.
Make sure to match the water temperature and treat with dechlorinator to make it safe.
This helps to slowly allow him to get used to the fresher new water.
It is not necessary if he has recently had the water changed, say with in a few days, unless the water smells very bad or is getting cloudy, like maybe from too much uneaten food.
Feed the 2 center halves and even the little part which becomes a sprout.
Let him get hungry by not feeding a regular time if you are going to feed peas. See if he eats the peas, sometimes they need to get used to it and be hungry to try it, and usually like it.
You can try using a fresh clove or garlic and squeezing a few drops of the juice onto the food pellets you usually feed and let him eat that.
There is also Epsom salts in water.
See how the foods work. Peas help him poop, and garlic is a natural antibacterial and more.
If you do have Epsom salt no additives, only ingredient Epsom salt, you can dissolve a teaspoon per gallon amount into a cup, and after you are done with the pwc's you can add 1/4 of the liquid to the tank, then a few hours later 1/4, etc. It can help them feel better and poop