It takes fewer calories to sustain your weight than to gain weight.
To gain weight, you need to eat at a caloric surplus. But after you reach your goal weight, you will not need to eat at a caloric surplus anymore, so you will be able to consume fewer calories. You can get an estimate of what your “maintenance calories” will be at your target weight by using a calculator like this: https://tdeecalculator.net/