Some of the least enjoyable, most miserable workouts I have ever endured have been the workouts I did as "punishment" to myself for eating something "bad." We've all had them, we all do them from time to time.
Working out is not a punishment. It is a privilege!
If you don't feel this way, you need to find a different workout, or change your mindset. If you begin a workout feeling guilty about something you ate, put thoughts of that out of your head. Focus instead on the way your muscles feel, focus on your breathing, think about your form. Be in the moment, banish negativity, and start loving exercise!