  We analyze the origin and properties of the chaotic dynamics of two atomic
ensembles in a driven-dissipative experimental setup, where they are
collectively damped by a bad cavity mode and incoherently pumped by a Raman
laser. Starting from the mean-field equations, we explain the emergence of
chaos by way of quasiperiodicity -- presence of two or more incommensurate
frequencies. This is known as the Ruelle-Takens-Newhouse route to chaos. The
equations of motion have a $\mathbb{Z}_{2}$-symmetry with respect to the
interchange of the two ensembles. However, some of the attractors of these
equations spontaneously break this symmetry. To understand the emergence and
subsequent properties of various attractors, we concurrently study the
mean-field trajectories, Poincar\'{e} sections, maximum and conditional
Lyapunov exponents, and power spectra. Using Floquet analysis, we show that
quasiperiodicity is born out of non $\mathbb{Z}_{2}$-symmetric oscillations via
a supercritical Neimark-Sacker bifurcation. Changing the detuning between the
level spacings in the two ensembles and the repump rate results in the
synchronization of the two chaotic ensembles. In this regime, the chaotic
intensity fluctuations of the light radiated by the two ensembles are
identical. Identifying the synchronization manifold, we understand the origin
of synchronized chaos as a tangent bifurcation intermittency of the
$\mathbb{Z}_{2}$-symmetric oscillations. At its birth, synchronized chaos is
unstable. The interaction of this attractor with other attractors causes on-off
intermittency until the synchronization manifold becomes sufficiently
attractive. We also show coexistence of different phases in small pockets near
the boundaries.
