The body gets the energy that it needs from food and then it uses this energy to breathe, generate new cells, think, move around, etc. If you want to gain weight, you'll need to eat more energy than your body needs. There's this scientific term, homeostasis, and it describes the physiological process where a variable is held constant through active regulation. What does that even mean? It means our bodies are actively trying to maintain their current weight. If you eat more energy one day than your body needs, what do you think your body will do with that extra energy? A naturally fat guy might store that as fat, but as hard-gainers, their bodies will try to burn it before storing it. It is very difficult for a skinny guy to put on some good weight (muscle mass). It is because of the ill diet practices and their genetics.