I don't think you should beat yourself up over it... but I wonder what was your diet like before you got pregnant?
Adopting a healthy lifestyle & eating well is really hard to do in a short period of time. And having made the change myself this year, one thing I have learned is that it's a vicious circle. E.g. if you don't eat well & get plenty of excercise, energy slumps, you crave cakes and carbs to give you that quick fix, and then your energy slumps even more.
One thing that worked for me is to stop thinking about "stopping" behaviours. E.g. it's not helpful to deny yourself something you're craving, because then you just feel horrible and guilty.
Instead start thinking about "starting" behaviours. E.g. I will start each dinner with a healthy vegetable soup, I will have 1 portion of fruit before I have pudding (but I can still have the pudding if I'm still hungry afterwards!), I will drink a full glass of water before I drink a less healthy drink like cola or coffee.
Eventually these "starting" behaviours take hold, and the best part is, even after bubs is born, you can stick to them. (Because looking after yourself is even more important once you have a little one dependant on you, I think!!)