I think that's an insulin thing. I can put myself in a similar state with healthy home cooked food, it just takes a bit of empty sugary/starchy calories.
Some foods spike your insulin levels and 3 to 4 hours later your body is so glucose deprived that you feel bad and depressed, but take one bite to eat and within 5 minutes you're chipper again.
So the solution then is to eat less of the food that makes you crash and more of the food that keeps your mood on an even keel. It also doesn't help that caffeine from sugary sodas wears off around the same time as the sugar crash - double whammy of depressed.
Some foods spike your insulin levels and 3 to 4 hours later your body is so glucose deprived that you feel bad and depressed, but take one bite to eat and within 5 minutes you're chipper again.