802.11 technology has its origins in a 1985 ruling by the U.S. Federal Communications Commission that released the ISM band[1] for unlicensed use.[3]
In 1991 NCR Corporation/AT&T (now Nokia Labs and LSI Corporation) invented a precursor to 802.11 in Nieuwegein, the Netherlands. The inventors initially intended to use the technology for cashier systems. The first wireless products were brought to the market under the name WaveLAN with raw data rates of 1 Mbit/s and 2 Mbit/s.
Vic Hayes, who held the chair of IEEE 802.11 for 10 years, and has been called the "father of Wi-Fi", was involved in designing the initial 802.11b and 802.11a standards within the IEEE.[4]
In 1999, the Wi-Fi Alliance was formed as a trade association to hold the Wi-Fi trademark under which most products are sold.[5]
The relevant regulation can be found in this Wikipedia page for ISM Band. Your short range consumer electronics are designed to operate in the ISM band because it does not require a license.
The Wikipedia page for frequency allocation will also give you an idea of what the other bands are used for...
The frequency allocation is organized in world wide basis by international communication union. Every country has its own authority for regulating the use of the frequency spectrum. The bands are allocated fro specific wireless services. The ISM bands are allocated for industrial, scientific, and medical wireless services. The 2.4 band is allocated for microwave heating.
In general there are factors governing the frequency allocation process where the frequency spectrum bands are divided among specific services some of them are licensed and the other is unlicensed.
For the factors governing the frequency allocation process please refer to the paper in the site: https://www.itu.int/dms_pubrec/itu-r/.../R-REC-SM.1131-0-199510-I!!MSW-E.docx
As explained above, World standards bodies have set aside certain bands for ISM use. This goes back to a time way before the wide use of WiFi and wireless by the way. Most significant aspect of these bands is that they are unlicensed. Which means as long as one follows certain rules and stays within certain limits, especially power, you do not need an FCC license to operate your equipment in these bands. This is why you can just take your new router and plug it in and start using since the manufacturer has already guranteed that their equipment will stay within legal boundries of RF operation. . There are other ISM bands at even higher (and lower) frequencies but for obvious reasons 2.4 and 5.8 GHz are the preferred bands for WiFi applications. Since no one owns these bands, they have to be shared and that is why all developed standards aim to accomodate multiple users as efficiently as possible within a particular ISM band.
Ok, why specifically 2.4 and 5.8 GHz? Firstly, they are available. Most importantly they have enough frequency realeastate to accomodate modern wideband signals. Lower ISM bands are just not wide enough to be useful for WiFi needs. Why not higher? Well, the idea is to use highest and broadest band available within the confines of economics and technology. ICs at higher bands become very expensive, though smaller antenna size would have been very desirable. On the other hand higher frequencies have shorter ranges and attanuate faster. Not to mention less efficiency in general which is a problem for mobile. So 2.4 GHz became the first band of choice since technology at the time was economical. Now 5.8 Ghz is economical too and more available. In time, with 5G, even higher bands will be commonly used due to improving econmics and technology trade offs.
Sequel to Murat Eron's concluding remarks: "In time, with 5G, even higher bands will be commonly used due to improving economics and technology trade-offs", 60 GHz (in the higher millimeter-wave band) has been standardized for WLAN applications. Vendors and consumer electronics manufacturers are already demonstrating WiFi at 60 GHz (IEEE 802.11ad), with full commercialization widely expected later this year (2017). In the near future, as technology advances, ISM bands will likely move even higher in the EM spectrum such as the terahertz (THz) bands.
Choosing the precise value of 2.4 and 5 GHz is somehow related to what researchers have unified their acceptance for the optimal usage of microwave spectrum. We need to know the background knowledge upon which such decision was taken.