Dissipative Kerr solitons in optical microresonators provide a unifying framework for nonlinear optical physics with photonic-integrated technologies and have recently been employed in a wide range of applications from coherent communications to astrophysical spectrometer calibration. Dissipative Kerr solitons can form a rich variety of stable states, ranging from breathers to multiplesoliton formations, among which, the recently discovered soliton crystals stand out. They represent temporally-ordered ensembles of soliton pulses, which can be regularly arranged by a modulation of the continuous-wave intracavity driving field. To date, however, the dynamics of soliton crystals remains mainly unexplored. Moreover, the vast majority of the reported crystals contained defects -missing or shifted pulses, breaking the symmetry of these states, and no procedure to avoid such defects was suggested. Here we explore the dynamical properties of soliton crystals and discover that often-neglected chaotic operating regimes of the driven optical microresonator are the key to their understanding. In contrast to prior work, we prove the viability of deterministic generation of perfect soliton crystal states, which correspond to a stable, defect-free lattice of optical pulses inside the cavity. We discover the existence of a critical pump power, below which the stochastic process of soliton excitation suddenly becomes deterministic enabling faultless, device-independent access to perfect soliton crystals. Furthermore, we demonstrate the switching of soliton crystal states and prove that it is also tightly linked to the pump power and is only possible in the regime of transient chaos. Finally, we report a number of other dynamical phenomena experimentally observed in soliton crystals including the formation of breathers, transitions between soliton crystals, their melting, and recrystallization. arXiv:1903.07122v2 [physics.optics]