There wasnt always 50 states in the USA and it may not always be like that. We have gone through several different flags over the history as we have grown to include more states. Puerto Rico has been considered for a future USA state for a while. It just is coincidence that we are currently at 50 states.
Just how it turned out. Only had 48 states until the late 1950's. then Hawaii and Alaska were added as the 49th and 50th states in 1959. So only had fifty states for 54 years. Before 1959 we had only 48 states for 47 years from 1912 to 1959. As other have pointed out, if Puerto Rico ever agrees we will one day have 51 states.