Results are presented from a numerical study of the effect of an external magnetic field on the conditions and mechanisms for the formation of a virtual cathode in a relativistic electron beam. Characteristic features of the nonlinear dynamics of an electron beam with a virtual cathode are considered when the external magnetic field is varied. Various mechanisms are investigated by which the virtual cathode oscillations become chaotic and their spectrum becomes a multifrequency spectrum, thereby complicating the dynamics of the vircator system. A general mechanism for chaotization of the oscillations of a virtual cathode in a vircator system is revealed: the electron structures that form in an electron beam interact by means of a common space charge field to give rise to additional internal feedback. That the oscillations of a virtual cathode change from the chaotic to the periodic regime is due to the suppression of the mechanism for forming secondary electron structures.