Coffee the genome, and the alleles that you inherit therein, are luck. They are a random set of determinants which are the instructions for making your body. These instructions are slightly different for everybody, which creates variation in our species and all species. Some badluck is a high risk for cancer if you have a BRAC1 mutation for example. Some good luck is CCR5 allele which protects against HIV.
In the case of the HIV example you have to have exposure to HIV ( environment)to allow the allele come into its own ( genetics) and prevent infection.
It has been discovered that there are alleles that confer risk or protect against obesity. About one third of the population carry increased risk alleles for obesity and about two thirds carry protective alleles.
Therefore , having risk alleles for obesity is down to chance or luck and having alleles that increase likelihood of thinness is luck.
People who have increased risk of obesity can eat the same foods and have the same activity levels and be up to 20% fatter.
Obesity is a a spectrum and involves levels of fatness and fat distribution which alters with gender and age.
Obese individuals can diet but it is harder for some people to gain weight and harder for some to look. Most obese individuals fail after five years, to maintain any weight loss. Basically because their metabolism is set up to hold onto fat.