Hi, well first off it depends on the gym you attend, many gyms only offer the national program and put all gymnasts into this program. A lot can be being in the right place at the right time.
Other gyms will be feeder programs, so they will search their gym for their youngest and most talented 4-5 year olds and place them in a development class to prepare them for selection, then the most talented of these will be assessed at a specialist High performance centre where they may be accepted to train.
In our area the High performance centre usually accepts kids from 4-6 years old, they may be accepted older but would generally already have had a higher level of training.