When anabolism occurs, dietary speaking, it is generally after catabolism. That is, after the foods that we eat or even our body fat and muscle tissue is broken down to its simpler forms, if those substrates (the simpler substances) are not then further broken down and used for energy, they can be reformed to their previous, more complex state or converted to and stored as something else.
Understand that simplistically, our bodies require a certain amount of energy, which we measure in calories, to operate based on numerous factors including our activity level. If we consume more calories from food than what the body needs, then thats when anabolism occurs. Lets look at, for example, a medium size bag of chips that you consume sitting at your desk and contains 350 calories. If your body, in a somewhat sedetary states, only requires 80 calories of energy that hour, then you have a surplus of 270 calories. Chips are primarily a carb and has some fat, so they are digested and broken down to glucose and fatty acids (catabolism) in the bloodstream.
Since again, there is more of these in the bloodstream than what the body needs, the unneeded fatty acids AND glucose are converted to fat (anabolism) and stored for when the body actually needs it. This is simplistic and when we actually get to the science behind diets we will go deeper, but it is the general mindset behind diets. Cater food intake such that catabolism is constant and prevent anabolism from being the body’s main focus. In other words, break down and burn, not store.
Hint: This is why eating smaller, more frequent meals facilitates weight loss. Keeping the amount of glucose and fat in the blood minimal at any given time helps prevent the body from switching from a ‘break down’ mindset to a ‘store’ mindset. Conversely, the body will be less apt to store if it atually requires the energy, which is where exercise comes in.