A very simple guideline for cutting; -500 calories under your TDEE(total daily energy expenditure) this is your basal metabolic rate plus whatever you burn from exercise(don't overestimate this, it's very common).
So if you spend 3000 calories a day total, consume 2500 during your cut. Diet is about 80% like previously stated, the rest is training and rest. Macro nutrients are important too, don't kill yourself counting them for now. Just focus on getting enough protein and a decent amount of carbs and fat. Calories in and calories out is very important. Energy balance is what drives lipogenesis and lipolysis( fat store and fat oxidation)
*Warning* Science & Math [ Proceed with Caution ] : 1 lbs of fat is equal to 3500 calories. In order to gain one lbs fat, you have to be in a caloric surplus to equal 3500 calories(over time of course, and i am over simplifying it) If you cut 500 calories every single day, in one week you will have burned 3500 calories (500x7=3500 calories=1lbs fat) It never works out EXACTLY that way, but that's the basic science of cutting. Now by keeping protein intake adequate and focusing on maintaining strength in the gym, you will decrease strength loss and improve muscle retention. If you do it right you could even GAIN muscle on a cut( this is very rare and is usually exclusive to beginers, genetic anomalies i.e. freaks, and those using androgenic anabolic steroids or other compounds) The reason why carbohydrates are important as a macro nutrient is because they are the primary fuel for muscles. Thinks of gasoline as petroleum gasoline, the most efficient and powerful energy source for a car engine. Yes, fat can be used for energy, but it cannot be burned up as quickly and produce the same power and endurance. You need to consume an adequate amount of carbs to fuel your workouts and maintain your strength and energy. Carbs are also important for optimal thyroid function, which affects your metabolism( something we obviously need on a cut) and mood. Fats are important for cell structure and optimal hormone production and most important it makes food taste good. If you cut out too much fat, food will not taste as good. There is no reason a cut has to suck and taste too bland. The reason cutting fat out is recommend is because fat is the most calorically dense macro nutrient. It has the highest amount of energy PER gram than any other macro. So obviously, if you eat too much fat, you risk upping the calories substantially. That's nutrition/thermodynamics/bodybuilding 101 for you. That's only the very tip of the iceberg.