  We explore the quantum dynamics of nuclear spin relaxation in cold collisions
of $^1\Sigma^+$ molecules with structureless atoms in an external magnetic
field. To this end, we develop a rigorous coupled-channel methodology, which
accounts for rotational and nuclear spin degrees of freedom of $^1\Sigma^+$
molecules, their interaction with an external magnetic field, as well as for
anisotropic atom-molecule interactions. We apply the methodology to study
collisional relaxation of the nuclear spin sublevels of $^{13}$CO molecules
immersed in a cold buffer gas of $^4$He atoms. We find that nuclear spin
relaxation in the ground rotational manifold of CO occurs extremely slowly due
to the absence of direct couplings between the nuclear spin sublevels. The
rates of collisional transitions between the $N=1$ nuclear spin states of CO
are generally much higher due to the direct nuclear spin-rotation coupling
between the states. These transitions obey selection rules, which depend on the
values of space-fixed projections of rotational and nuclear spin angular
momenta for the initial and final molecular states. For some initial states, we
also observe a strong magnetic field dependence, which can be understood using
the first Born approximation. We use our calculated nuclear spin relaxation
rates to investigate the thermalization of a single nuclear spin state of
CO$(N=0)$ immersed in a cold buffer gas of He. The calculated nuclear spin
relaxation times ($T_1\simeq 0.5$ s at $T=1$ K) display a steep temperature
dependence decreasing rapidly at elevated temperatures due to the increased
population of rotationally excited states, which undergo nuclear spin
relaxation at a much faster rate. Thus, long relaxation times of $N=0$ nuclear
spin states in cold collisions with buffer gas atoms can only be maintained at
sufficiently low temperatures ($kT\ll 2B_e$), where $B_e$ is the rotational
constant.
