The remarkable discovery by the Chandra X-ray observatory that the Crab nebula's jet periodically changes direction provides a challenge to our understanding of astrophysical jet dynamics. It has been suggested that this phenomenon may be the consequence of magnetic fields and magnetohydrodynamic instabilities, but experimental demonstration in a controlled laboratory environment has remained elusive. Here we report experiments that use high-power lasers to create a plasma jet that can be directly compared with the Crab jet through well-defined physical scaling laws. The jet generates its own embedded toroidal magnetic fields; as it moves, plasma instabilities result in multiple deflections of the propagation direction, mimicking the kink behaviour of the Crab jet. The experiment is modelled with three-dimensional numerical simulations that show exactly how the instability develops and results in changes of direction of the jet.