I’m sure some people put weight on more easily than others, and there are certainly people who can eat masses and stay slim, because of how their metabolism works.
But no, I don’t think it’s all down to genes. When I first visited the US in the mid 1970s I was amazed (like many others at the time) to see so many hugely fat people - something you just didn’t see in the U.K. then. The odd person, yes, but nothing like so many.
It was so quickly obvious why - food on sale everywhere, vast plates and portions of it, food everywhere you looked (a lot of it fatty junk) and people eating - not just inside, but walking about eating, too. Fries came in almost bucket-size portions.
On our very first morning in the US we had breakfast at a place where on the next table a hugely fat boy of maybe 12 was tucking into a vast plate of food, including a pile of pancakes a few inches high with a massive lump of butter on top.
The U.K. has now gone at least partly the same way with so much relatively cheap junk food available in so many places, as well as in supermarkets - that just wasn’t the case here back in the 70s. And I doubt that people’s genes have changed - many are just eating more, and satisfying, relatively cheap food is so widely available.
By contrast, in the late 90s on a visit to Prague, an American tourist we met marvelled at the fact that the people were so slim when the food largely on offer was (to her) ‘unhealthy’ - a lot of it being meat, fried potatoes, dumplings, etc., few vegetables.
Answer, presumably, because portions were moderate, there was very little fast food available, so people presumably cooked mostly from scratch - and relatively few then had cars, so they walked a lot.
How all that may have changed now, I don’t know.
.