We conducted a numerical simulation of ventilated supercavitation from a forward-facing cavitator in unsteady flows generated by a gust generator under different gust angles of attack and gust frequencies. The numerical method is validated through the experimental results under specific steady and unsteady conditions. It is shown that the simulation can capture the degree of cavity shape fluctuation and internal pressure variation in a gust cycle. Specifically, the cavity centerline shows periodic wavelike undulation with a maximum amplitude matching that of the incoming flow perturbation. The cavity internal pressure also fluctuates periodically, causing the corresponding change of difference between internal and external pressure across the closure that leads to the closure mode change in a gust cycle. In addition, the simulation captures the variation of cavity internal flow, particularly the development internal flow boundary layer along the cavitator mounting strut, upon the incoming flow perturbation, correlating with cavity deformation and closure mode variation. With increasing angle of attack, the cavity exhibits augmented wavelike undulation and pressure fluctuation. As the wavelength of the flow perturbation approaches the cavity length with increasing gust frequency, the cavity experiences stronger wavelike undulation and internal pressure fluctuation but reduced cavitation number variation.