There are a lot of reasons and I don't think it's known what factors led to the final decision.
For one thing, when the basic Bitcoin mechanics were designed, there was a significant risk that Bitcoin would never be adopted. By giving a fixed term to mining and a fixed supply of Bitcoins, the original designer(s) increased the chances that people would want to acquire Bitcoins. The prospect that future scarcity would increase their value likely induced people to mine even when the economic argument for doing so was quite thin.
It's also possible that there was hope that people who didn't like inflationary currencies would be drawn to Bitcoin. There are people who see inflation as a theft or tax. The ultimate lack of inflation in Bitcoin attracted people with those views to the currency.
And, of course, some way was needed to distribute the currency. Using the initial distribution of the currency as a way to build sufficient computing power to use proof of work to secure the currency until transaction fees could take over was probably Bitcoin's biggest bit of genius.
It appears this strategy worked, at least so far.
1
possible duplicate of Why was 21 million picked as the number of bitcoins to be created?
– Stephen Gornick – 2013-04-12T08:24:09.0976I think this question is slightly different, asking why there's an upper limit as opposed to an unlimited supply rather than why the upper limit is 21 million as opposed to some other number. – David Schwartz – 2013-04-12T08:34:21.750
Now that I know more, I'll add that the 21 million limit is a bit of a misdirection. Bitcoin is currently divisible by 8 decimals, making the total supply actually 21,000,000 * 100,000,000 units. I'm not sure, but I bet that's a greater number than the total world currency supply. Further, it would be a simple software update to add more decimals. – 4276 – 2017-11-03T23:25:05.730