Not really. While going to the gym and exercising is very important you can´t simply get the calories out of your body. There are many more aspects to it.
Different foods have different properties. Processed foods are full of sugars and toxins which inflame your body, and when your body is inflamed, it will have really hard times losing weight. Joint pain and high blood pressure are highly associated with consumption of processed foods too.
On the other hand, freshly prepared whole food meals will support your body with all the nutrients it needs in order to stay healthy and fit. It will make you feel better, look better, and perform better. Then when you go to the gym, your body will be a lot more responsive, and the workouts will become easier and more fun.