When you eat sugar, you spike your insulin. When you spike your insulin, you are signaling to the body that you’ve just been fed.
As others have pointed out, this blanket admonition against sugar is overbroad and likely not sound nutrition.
First: most of the foods that you will eat will be turned into glucose — which is sugar — in your body. Saying not to eat sugar is saying, in essence, not to eat. The point should be not to eat excess sugar.
Secondly: Because of the first point, the conversion to glucose, your body will always release insulin in response to eating. You are correct, however that we should not SPIKE our insulin… that is to say cause a large amount of insulin to be released all at once. This goes to the point of not eating excess sugar and what others have said about eating processed and refined sugar (which make it to the bloodstream faster and makes spikier the spike.) This, however, has less to do with signalling to the body that you’ve just been fed (after all, you have just been fed, whatever you eat, and your body should know that) and causing fat packing but with an inflammatory response to spiked blood sugar/insulin that we have only recently begun to understand.
Thirdly, fruit is fibrous and that takes time to digest: it is very nearly impossible to spike your blood sugar levels with fruit alone, no matter the sugar content of the fruit. It takes time to break the fruit down (and this is also helpful for the so called ‘gut biome’) and is released over a longer time: i.e. generally not as a spike. This is in contrast to refined sugars which, essentially, get shot right into your bloodstream without much work on the part of the digestive system.