You failed, because in some way—mental or emotional—you were lazy. You lacked the humility or drive to examine your habits, then adjust and sustain them.
This comes down to being unable to change your thinking.
As a perfect example of this, many binge eaters who come to me unable to lose weight are actually over-exercisers and under eat until they hit a breaking point, followed by an uncontrolled binge. Even before training them, I tell them that they need to actually exercise less and eat a higher volume of food more consistently. Some trust me and we make good progress. Others don’t get that far. They were too stuck in their ways and preconceived notions to successfully affect change.