We performed numerical simulations of a non-steady separated shear layer with and without cavitation to examine the effect on flow dynamics. Particular focus was given to the interaction between vortices and cavitation. In the simulations, streamwise and spanwise vortices generated by the instability of a shear layer flow, typical features in such a flow field, were formed further upstream in cavitating than in non-cavitating flows. In cavitating flows, the vortex shedding frequency and the Reynolds stresses increase, and we observed vortex weakening caused by cavitation. We found that a Burgers-type vortex can become the origin of a cavity. Contrarily, the growth of the cavity attenuates the corresponding vortex. We described this influence of a cavity on a streamwise vortex with a simple inviscid model.