The Solar System’s orbital structure is thought to have been sculpted by an episode of dynamical instability among the giant planets. However, the instability trigger and timing have not been clearly established. Hydrodynamical modeling has shown that while the Sun’s gaseous protoplanetary disk was present the giant planets migrated into a compact orbital configuration in a chain of resonances. Here we use dynamical simulations to show that the giant planets’ instability was likely triggered by the dispersal of the gaseous disk. As the disk evaporated from the inside-out, its inner edge swept successively across and dynamically perturbed each planet’s orbit in turn. The associated orbital shift caused a dynamical compression of the exterior part of the system, ultimately triggering instability. The final orbits of our simulated systems match those of the Solar System for a viable range of astrophysical parameters. The giant planet instability therefore took place as the gaseous disk dissipated, constrained by astronomical observations to be a few to ten million years after the birth of the Solar System. Terrestrial planet formation would not complete until after such an early giant planet instability; the growing terrestrial planets may even have been sculpted by its perturbations, explaining the small mass of Mars relative to Earth.