My opinion is that today, "we don't yet know what causes Type 2 diabetes."
In many cases it is associated with being overweight/obese, bad diet, lack of exercise, lack of sleep, stress, and so forth. The body becomes "insulin resistant" and the pancreas produces more and more insulin, to help convert food carbohydrates into energy. Because of the insulin resistance, this becomes a vicious circle. If the condition is untreated the pancreas eventually becomes "tired" and produces less insulin.
But we still don't really know how the causation works. Some of the things that many diabetics have (too much weight for instance) could be in part, or even wholly, the result of their diabetes (or the result of their predisposition to diabetes). Or, perhaps, the causation works in both directions in a sinister spiral.
There is also a genetic factor.
Me? I've always been thin. But I was eating a lot of carbohydrates, not taking enough exercise, and was about 10 kilos above my "normal" weight for a very-thin person, even though the usual medical scale (the "BMI") showed that I was supposedly not overweight. I am in a high-stress job (a "work-feast-or-famine" home business) and sometimes go through periods when I do not sleep well, or get up very early to finish an urgent project.
I have one first cousin who has been a Type 1 diabetic since her teenage years, and another first cousin who developed Type 2 diabetes in his late 30s. Both of these cousins have never been overweight, and one of them (the one with Type 2) is in a very physically active job. He has to work really hard to control his A1C because if he ever becomes insulin-dependent, he will lose his job.
Barring some revolution in medical science, I will never know what "caused" my diabetes. Maybe (probably??) if I had eaten properly and exercised more, I would never had developed the disease. But I cannot know for sure. I live in America, and believe me, every day I see people walking around who are grossly obese, are eating much worse than I did, and never take any exercise. Most of them don't develop diabetes.
This is just my non-scientific "two cents" as they say here in America.