Yes, I have asked myself that same question many times. Why did I eat that when I know it isn't good for me? I always get the same answer "Because I made the choice to do so." Every action we do first begins with a thought. I often then have a dialogue go on in my head that lists the pros and cons. It is sort of like the devil and the angel on the shoulders, each whispering their suggestions in the ear. You choose to listen to the voice of reason for the good or bad, then you decide to act on it.
I am my own worst enemy because I choose to be. The best way to combat that is to have a list of positive reasons as to why you do not want to eat a particular food so it will be easier to make better choice.
Hopes this helps and lets you know that you are not alone.