For many people, eating is a powerful coping mechanism for negative emotions because they give it power. They tell themselves, “Eating will help me feel better,” and then it does (in the short term).
Instead, remind yourself that eating will ultimately ALWAYS make the situation worse (because it doesn’t solve the first problem and just creates more), and then try giving something else power, like drinking hot tea or taking a walk.