Unlike previous Mainstream Pokemon Games, every Pokemon Gym found within this game have certain requirements that must be met before your trainer will be allowed to challenge said Gym. The eighth and final Pokemon Gym within the Kanto Region is found back in Viridian City. When you first start your journey, this Pokemon Gym will be vacant. In order for the Gym Leader to return, you will first need to defeat Team Rocket in the Silph Co Building and earn the other seven Kanto Gym Badges.
However, even after doing all of this, you will come to find that the Viridian City Gym is still locked. Your Rival will then suggest talking with Professor Oak back in Pallet Town to see if he can help in any possible way. When you reach the Pokemon Lab, you will discover Blue is there with Professor Oak. Blue will give you a Key Stone, which is needed in order to Mega Evolve certain Pokemon when in battle, as well as the Mega Stones for Venusaur, Charizard and Blastoise. After he does this, he will go to Viridian City to see as to why the Pokemon Gym remains locked. After he departs, the Gym will actually become unlocked and you will instantly have access to challenge it.