There are at least three main factors at work here but first, I would (personally) reframe your Title Question as: "Two Year old, potty trained or not, pees every 20-30 minutes." That's probably the reality, though most people don't really know how often their 2 year old's go because they don't know about a wet diaper until after a few pee's have built up.
Evacuating at certain levels, like breathing is an automatic response. As an Adult you exert a certain force of will to prevent unscheduled evacuations just as you would by holding your breath. Physics, however, will override your force of will. At some point your body will take over and do what it needs to do. With a small child you have primitive neural networking and incomplete control over your body. When the bladder fills it empties without the child needing to intervene.
You can also get a feeling for the basic science by pretending the bladder is a sphere. The larger the bladder becomes when full the more volume it can hold, that is a no-brainer, right? It is not a 1:1 ratio however. As you increase the surface area of the bladder the max volume increases at a faster rate. In a 2 year old the max capacity is very small. The ratio is approx 4.8 for Surface Area to Volume. So if the surface area of the bladder is 2sq inches the volume is 0.266 in cubed. But double the surface area to 4 and the volume more than doubles to 0.751 in cubed (double would have been 0.532 in cubed). Now, the bladder is not a sphere but what this should illustrate is that when the bladder is tiny it is going to fill and empty quite often. As the child grows they will be able to hold drastically more fluid in the bladder with roughly the same fill rate leading to more time in between evacuations.
Third, is time. I'm not talking about the measure of it, just being able to differentiate past, present and future. How children develop sense time.
In order to not wet yourself, you have to :
- Be able to recognize you have to go.
- Be able to recognize you have to go far enough in advance to be able to act on it.
- Be able to prevent bladder release until you are at a facility.
My 3.5 year old is just now starting to grasp the difference between today, yesterday, and later. He doesn't recognize the feeling of a full bladder until is it right up on him (less than 10 seconds). For bowel movements is it all past tense...
Analysis:
Most likely, what you are defining as potty training, is largely more likely to be dumb luck getting him to a restroom in just the right window. Granted you are probably saving $ on diapers, but if he can't exert conscious control and plan ahead, he isn't actually learning.
As far as to how long he can "hold it" under certain circumstances is concerned, that is easily explainable as stress. Stress is not a "bad" thing. Stress is a motivating force. Fun things can be stressful (competition, physical or mental, for example.). When under stress, your body has common and normal responses, one of which is causing various systems in the body to tense up. Evacuating takes a certain amount of relaxation to get going. There is a certain primal instinct in all of us that going outside of our home is a chance of being eaten by a predator. Therefore he appears to be able to "hold-it" longer because his body is giving him no choice to relax. He is tensed and primed for danger.
Take all of this together, and what you get is a target age to start introducing potty training sometime near age 3, give or take.