Google 'TDEE'. It's your total daily energy expenditure, aka how much energy you actually burn a day. If you eat over this amount of calories, you gain weight, if you eat on it, you lose weight and if you eat under your TDEE you lose weight. It doesn't have to be drastic, just count your calories and have a slight deficit eg. 200 calories less a day than you usually eat. Going to the gym is just an extra way to burn even more calories. The app MyFitnessPal is good for counting.