It is because Japan is a volcanic archipelago that it can be home to the largest amount of hot spring sources in the world. The more sources there are, the more onsen exist. To read more about the process of how onsen form, you can read How Onsen Works: A Geothermal Gift.