The dynamics of exotic hypernuclei in heavy-ion collisions has been investigated thoroughly with a microscopic transport model. All possible channels on hyperon ($Lambda$, $Sigma$ and $Xi$) production near threshold energies are implemented in the transport model. The light complex fragments (Z$leq$2) are constructed with the Wigner-function method. The classical phase-space coalescence is used for recognizing heavy nuclear and hyperfragments and the statistical model is taken for describing the decay process. The nuclear fragmentation reactions of the available experimental data from the ALADIN collaboration are well reproduced by the combined approach. It is found that the in-medium potentials of strange particles influence the strangeness production and fragment formation. The hyperfragments are mainly created in the projectile or target-like rapidity region and the yields are reduced about the 3-order magnitude in comparison to the nuclear fragments. The hypernuclear dynamics of HypHI data is well described with the model. The possible experiments for producing the neutron-rich hyperfragments at the high-intensity heavy-ion accelerator facility (HIAF) are discussed.