It’s a function of how many bullets you can fit into the cylinder without making it too large. You could hypothetically build a revolver with space for more rounds, but you’d start wasting a lot of space in the middle of the cylinder and the gun would get too bulky. [Here’s an example](https://www.reddit.com/r/guns/comments/aymp77/are_7_shot_revolvers_accepted_here/) of a seven shot revolver.
Note that revolvers made to shoot large caliber ammunition sometimes only fit 5 rounds.
Because of the way 7 circles nestle together efficiently in a tight hexagon. It is the same reason bees’ honeycombs are hexagonal.:
. O O
O O O
. O O
The cylinder holds 6 shots and the center axle on which it revolves with a minimum of extra metal or bulk. Adding rounds would increase wasted extra metal and bulk.
Latest Answers