That's pretty typical behavior for a fish. If they don't like what they find, they immediately spit it out. Perhaps it could be the food, but it could also be due to the water quality making things taste bad. You should try different food, and also change some of the water every week, around 20%. Just don't change it all, or you will destroy the beneficial bacteria that helps break down waste. Then your water gets a big rise of ammonia as it tries to reestablish the nitrogen cycle, which is very detrimental to your fish.
Try changing his water.
Yeah, it can be really frustrating, just give him some time, my fish did it 2 and now they eat SO much *laughs*