In the original 1001 Nights (a.k.a. Arabian Nights) story "Aladdin" the titular character gets a lamp that contains a magical being called a "genie" that grants wishes. This is fairly common knowledge nowadays with the Disney movie of the story. However, in the original story, there is no limit to the wishes made. Whoever controls the lamp, is the master of the genie and has (seemingly) no limitation of what they can wish for. If there is a restriction it would be a on what the genie is capable of.
Yet, the Disney movie shows that the genie only grants three wishes and three wishes only per master. Many depictions of lamp genies have a similar limitation - three wishes for the owner of the lamp. It's quite ingrained into popular culture with a lot of jokes and/or setups that implicitly have this three wish limit imposed. For example, if three people somehow find the lamp, they might get one wish each or one person could use his wishes to try and create a loophole for infinite wishes.
The number is really not surprising - three is a very common number when it comes to folk stories and a setup of three is very standard in short stories (like jokes). Three wishes even show up in a lot of folklore outside genies.
My question is not why we got to three wishes but when. Is there something concrete we can point to that combined "three wishes" and "genies"? Perhaps in particular lamp genies but perhaps it started with other genies.
For the record, there are many other genies that show up in 1001 Nights and the lamp genie from Aladdin is the only one of its kind - bound to a lamp as a servant to its master and grants wishes. For example, there is also a ring genie in the same story that is very similar - it again has no limitation on the number of wishes - it's mentioned that it's less powerful than the lamp genie. Most other genies that show up in other stories from the collection are free and don't grant wishes to mortals.