Several reasons. First, you need to recognize that any Sweden-based startup will, when it gets to be known internationally, have a Stockholm-based office. So it's not about a city of 1 million inhabitants, it's a country of 10 million that's the true number here. As an example, I believe Spotify opened their original offices in both Stockholm and Göteborg more or less simultaneously.
With that said, a commonly stated reason for why Sweden in general has such a high prevalence of tech startups comes from a bunch of fortuitious decisions in the 90s and 00s. In 1998 Sweden's government started a program that allowed employers to sell their employees computers under a tax free scheme (the so called Hem-PC-reformen https://sv.wikipedia.org/wiki/Hem-PC-reformen). This was extremely popular, and led almost every Swedish home to get an often extremely overpowered personal computer. Thus, practically everyone who was a kid in 1998-2006 (the rebate was cancelled in 2006) grew up with a computer. This gave Sweden a huge advantage compared to other countries in the early Internet revolution.
Sweden has also invested heavily in building a fiber network, you have access to gigabit Internet even in some extremely rural areas.
Another thing is that Sweden doesn't have the tradition of dubbing movies. That means kids will be exposed to English from an early age. This leads to Swedish tech companies not being afraid of hiring talent globally and generally use English as their business language.
Finally, out of the 5 examples posted, one is Mojang, which is clearly an outlier. I'm not saying what Notch accomplished wasn't extremely impressive, but it was essentially a one-man operation, and probably shouldn't be held as an example of a trend.