Our ancestors could never rely on getting enough to eat, so the body had to find a way of storing any surplus whenever there was a time of plenty. Our bodies still do this even though we now get enough to eat. So now we risk having too much of some things.
Fat contains energy and any that is not used immediately is stored for emergencies which are now rare. Salt is needed in tiny amounts for our digestion and muscles. But now we have salt added to many foods.