Obesity and being overweight are relatively subjective conditions that depend upon specific human definitions, in the same way that being tall is subjective. Part of this subjectivity comes from the fact that there is no empirically definite human weight; so, who determines what is overweight? Most people would probably be able to tell you that obesity has to do with being "too fat" or weighing too much for your height, and these would generally be correct, although they're somewhat abbreviated answers.
Virtually all animals have a means of storing excess energy that isn't immediately used to generate ATP. ATP itself is in fact a fairly short-lived molecule, so it isn't as simple as simply converting all of your food to ATP, and then allow that ATP to float around in your blood until it's used, or storing the ATP somewhere, because it'll just fall apart and the energy will be lost. Instead, we store excess energy in the form of fat. The exact mechanism by which this is accomplished is fairly complex, and is the subject of a large body of modern research.
Generally speaking, any number of calories consumed, which exceed the calories that the body is using at that time, will be stored as fat. Some foods, like fats, are much easier to store as fat than others, such as proteins, so the conversion between consumed food and stored body fat isn't always consistent across a range of diets. As the body accumulates fat, it will eventually reach a point of obesity, which in medical terms is a point where the total amount of fat the body is carrying begins to impede with basic physical functions and lead to disease.
Obesity may occur for a variety of reasons, but ultimately all of them are the result of the body taking in more calories than it uses. Currently one of the factors leading to higher rates of obesity in the world are the excess of cheap, low-nutrient carbohydrates and high-calorie fats, resulting in easy access to foods with a poor nutrient profile but high in calories.
While this is true, new research has drawn a link between generally toxic environments, defined broadly, and the ubiquitous (everywhere) presence of phthalates, a toxic volatile organic compound. Strong links have been made between childhood exposure to phthalates and obesity. Phthalates are found in vinyl, adhesive, grooming products, paints and many other common things.