We show that the heavy-fermion compound CeCu2Si2 undergoes a transition between two regimes dominated by different crystal-field states. At low pressure P and low temperature T the Ce 4f electron resides in the atomic crystal-field ground state, while at high P or T, the electron occupancy and spectral weight is transferred to an excited crystal-field level that hybridizes more strongly with itinerant states. These findings result from first-principles dynamical-mean-field-theory calculations. We predict experimental signatures of this orbital transition in X-ray spectroscopy. The corresponding fluctuations may be responsible for the second high-pressure superconducting dome observed in this and similar materials.