You can't eat a big meal (i.e. a lot of calories) whenever you want and just "work it off" later.  I mean it.  You may think (as I did) that if you're willing to work a little harder (or more consistently) in the gym, that you can eat pretty much what you want (within reason, of course) and still lose weight.

You can't.  It simply doesn't work.  Even if you come at me with EPOC (https://en.wikipedia.org/wiki/Excess_post-exercise_oxygen_consumption) -- unless you're lifting very heavy weights (and/or to failure) or doing high intensity interval training (HIIT), it just doesn't add up enough to counter a poor diet _or_ too many calories.  Instead, you have to start making better food choices and cut calories where you can.

Of course, I'm not saying don't hit the gym at all!   And, frankly, I don't think it matters much if you prefer aerobics, or walking,  or weight lifting, or cycling, etc.  They're all good!  And while I did say "hit the gym", I don't think you must have a gym membership in order to lose weight.  While there are valid reasons that may make it  worth the cost (maybe you don't know what exercises you like, maybe you find motivation seeing other people struggle just like you, or maybe you need a class-type atmosphere wher everyone is using kettlebells, etc.), but you can walk or run on the streets in your neighborhood, you can buy hand weights, a small weight set, exercise bands, and/or you can buy some other kind of equipment.  If it's important to you and you think you can keep it up at least three times per week, you can make it happen.

You also should aim to move a little more every day just to burn up some extra calories (take the stairs, park farther from work in the parking lot/garage when you can).  For example:  I was at a building with some family a few weeks ago and decided I wanted some coffee.  After discussing this and getting a few orders for Starbucks -- off I went -- going down seven flight of stairs and walking about a quarter mile to the coffee shop and back the same route -- a quarter mile of walking followed by going up seven flights of stairs.  I did have to make sure I had a carrier tray and the "green coffee spill stopper" that covers the opening in the lid plus a couple of times I had to pour a little more coffee out so I didn't spill it due to adding half and half (which I do allow in coffee for myself) and I used the green stevia packets they have now (I followed the wishes of everyone else for their additions).  The point is that I chose to take the seven flights of stairs down and up to get a little more exercise in my day.

I also want to be realistic.  It's OK to eat a little more here and there and add another 10 minutes on the treadmill (for example) or 2 more sets of lifting up heavy objects and then putting them back down.  If you want this diet to stick, you have to make some choices (or "compromises") you can live with -- so one larger than normal meal with dessert from time to time will not ruin your week and throw away all the effort you've put into healthy eating.  So, you can "work it off" to some extent -- just make sure you do the extra exercise and also reinforce your willpower to stick to your plan for the next few days.

This is the reason why people can lose weight doing programs like weight watchers, Atkins, Jenny Craig or even the "grapefruit diet" -- BECAUSE each of these do cut calories in one way or the other.  Some may be healthier than others, but they all work in similar ways.  However, I'm not sure these losses last because you never build healthier habits and don't make choices you can live with.  At least that's my experience.

Good luck!