People are constantly displaying the symptoms of "food is mood." When you try to work out for any extended period of time and don't feed the body right, your mind actually tries to sabotage your efforts. It makes you depressed and moody, and it does this on purpose, because it's trying to stop you from doing what it already knows you can't do - perform well on less than ideal nutrition.
You have to eat, drink, and sleep well first, then exercise. Treat nutrition and rest as your primary workout, because everything else feeds off of that energy supply. Until you do that, you are constantly cutting off your own potential at the knees.