No doubt it is a disease in medical sense of the word. It has a code on WHO's ICD-10 (The International Statistical Classification of Diseases and Related Health Problems, 10th Revision)
ICD-10 E66.0 Obesity due to excess calories
Common definitions of disease:
"A disease is an abnormal condition affecting the body of an
organism." (Dorland's Medical Dictionary)
disease: a condition of the living animal or plant body or of one of its parts
that impairs normal functioning and is typically manifested by
distinguishing signs and symptoms (Merriam-Webster)
There is little doubt that obesity is a disease according to both of above definitions.
Now, complete misunderstanding comes from interpreting "obesity is a disease" as "obesity is caused by a disease". However, in reality diet and lack of exercise are the leading causes.
The cause of obesity is complex and multifactorial. Within the context
of environmental, social and genetic factors, at the simplest level
obesity results from long-term positive energy balance — the
interaction of energy intake and energy expenditure. The rapid
increase in the prevalence of obesity over the past 20 years is a
result of environmental and cultural influences rather than genetic
factors. With progressive improvements in the standard of living in
developed and developing countries, overnutrition and sedentary
lifestyle have supplanted physical labour and regular physical
activity, which has resulted in positive energy balance and
overweight. (2006 Canadian clinical practice guidelines on the management and prevention of obesity in adults and children)
There is absolutely no contradiction between obesity being a disease, and the fact that it's caused by peoples' bad habits. There are numerous diseases, which are caused by bad habits. For example alcohol abuse if considered disease (ICD-10 F10), so is cocaine addiction (ICD-10 F14). However this does not mean that you can just use "it's a disease" as excuse, they are results of one's decisions.
In Global Burden of Disease metrics, high body-mass index ranks as the 6th highest death risk factor.