Fasting is a way in which to drop your insulin levels in your body (which stores fat), reduce inflammation, improve cholesterol and triglycerides, balance hormones, and while doing that access other energy sources - i.e. fat which helps with weight loss.
People do different levels of fasting for different reasons.
'Proper' fasting is 24 - 36 hours really as you want to instigate a process called autophagy which literally means "eat yourself". Which sounds gruesome, but it is a perfectly natural and very healthy process where the body renews it's cells, 'eating up' all the dead protein within cells, cleaning it out!
Lots of research coming out about how autophagy has incredible health benefits, even helpful in cancer treatments (the eating up of cancer would be beneficial alright!)
You would do his type of fasting mainly for the health benefits of autophagy.
Intermittent fasting is usually 18 hours fasting and 6 hours eating window. It helps do most of the things above, but most people do not get to autophagy point until around 17 hours so you don't tend to get those benefits if you do 18:6.
Low ultra processed food intake is key to making this manageable. You will get massive hunger cravings if you do it with processed crap, eat proper meals (meat and 2 veg type of food) and you will find it much easier.
There's a pretty good app called Fastic which explains the process your body is going through as you fast and what it is up to!