This is long, but we will get to Ozempic (semaglutide) effect in the end! ;)
Essentially, the way your insulin is regulated can vary, and one possible issue is "insulin resistance" - which results in slower reduction of insulin level in your blood, which means it takes longer for your body to actually enter fasting state (i.e. burning up more "fuel" than it adds from food converted into sugars). Semaglutide impacts the dynamics of insulin in your body.
In order to lose weight, you need to "fast" - which essentially means you have to enter state where triglycerides in your blood are turned into form that is ready to be burned up by cells. Reduction of triglycerides in your blood results in fat cells releasing more of them, causing fat loss.
However, human body prioritizes different fuels due to how "quick" sources they are for energy. Immediate use by muscles burns up glycogen stored in the muscles (you can consider it the closest-level cache). Rest of the body (and muscles when glycogen is reduced) burns up sugars (with muscles also having ability to metabolize triglycerides directly, IIRC). The sugars are provided by your liver which can metabolize (in order of preference) carbohydrates (including dietary sugars), fats (including triglycerides), and proteins (last ditch option because you're burning up materials your body wants for structural building).
So, in order to trigger fat burning, you need to have caloric deficiency that will require burning up the fat, right?
But you can do it inefficiently (and quite possibly harder to keep going, uselessly wasting willpower) by just having macroscale caloric deficiency but not putting your body into proper fasting state - so it's going to "sip" fats a bit over time but run mostly carbs-heavy all the time - or you can try to optimize. This is "fasting".
Normal, healthy people can enter fasting periods quite fast because they absorb the sugars faster (so the same amount of sugar is quicker available, meaning you also feel less need for them). Every time you hear about "regular 5 meals a day", it's advice for someone with that kind of metabolism.
What happens if you have insulin resistance (among other metabolic issues)? This "quick" turn to fasting might not work. Meaning your body won't switch "modes" regarding which fuel stores to use for energy as fast, and you need to have longer periods between meals, among other things. For example following a dietician-provided meal plan... when I did it incorrectly, with only 4 meals instead of 5, I was losing weight (but not fast enough), when I started to do 5 meals a day, I started gaining weight despite outwardly same caloric content. (You can easily consider that your body also informs your cravings which easily breaks your calorie count).
This is why some people do intermittent fasting, or why you're told not to eat just before sleeping (sleep provides for a natural fasting period, entering it with lower blood sugar means you get more benefit from it, and it's also a period of time where you do not burn up as much in muscles so the energy needs are lower - thus even more important to avoid carbs).
Similarly why people go for low-carb, high fat diets (fat being "harder" to process mean you can run the body mostly in fat-burning mode of operation because you run out of easy carbs faster).
So how does semaglutide (Ozempic/Wegovy/etc) work for this?
Semaglutide dampens insulin release. It's not going to fix my body slower removal of insulin, but it causes overall insulin levels to lower, and it dampens how much insulin is released when you digest food. Insulin controls the switching mechanism where your body decides "ok, I have a lot of blood sugar, let's store that into fats" or "oh, blood sugar is low, I should turn fats into carbs for immediate use". Simplified: High Insulin = sugar -> fats. Low Insulin = fats -> sugars.
So for healthy person insulin levels quickly follow the blood sugar reduction triggering fat burning within relatively short time from eating. Insulin-resistant person instead might find themselves feeling a strong signal to eat more - because their blood sugar is low and that can be problem (hypoglycemic collapse, etc).
Semaglutide can bring down too high base insulin level down, damp release of insulin when you eat, and for healthy person force their bodies to enter fasting state faster than it would normally, making it much easier to lose weight.
But by messing with insulin you're messing with huge set of dynamic, interdependant systems in your body, thus the worry of side effects.