In this study, a method for simulating the whole transient process of the cavitation evolution in a diesel injector was proposed. Diesel is taken as the fuel. The basic characteristics of partial, local, and super cavitation phenomena inside the injector were reproduced and discussed at different time steps. On the basis of movement features of the injector needle, Firstly, the moving process of the diesel injection such as the upward, suspension, and downward movements were simulated under different injector geometric parameters. The time-dependent movement process of the injector needle were controlled by a user-defined program developed by ourselves. Thereafter, a dynamic grid system and a two-phase flow cavitation numerical model were constructed and adopted to numerically reproduce the two-phase flow and the cavitation inside the injector. It was found that the volume fraction of the gas diesel during the partial cavitation is greater than that during the super-cavitation. The faster the needle valve opens, the earlier super-cavitation forms, but the gas volume fraction of diesel decreases faster in the injection orifice. Increasing the drain orifice diameter is helpful for earlier formation of the super-cavitation.