The first law of thermodynamics applies to closed systems, which your body is not. Yes it is true that, very broadly speaking, eating more results in weight gain past a certain point. But first principles are not the most proximate reason for that by a long shot.