The increasing demand for high-performance lightweight metallic materials is driving an interest in Plasma Electrolytic Oxidation (PEO) as one of the most promising techniques for surface engineering of Mg. In order to enable smart and multi-functional performance, it can be beneficial to incorporate nano-containers to carry appropriate active and functionalising agents into ceramic PEO coatings. Single-step in situ incorporation of nano-containers is challenging since their integrity may be compromised by high energy released during coating formation. We studied incorporation of halloysite nanotubes (HNTs) as potential nano-containers into forsterite, Mg2SiO4, formed during PEO processing of AM50 alloy at the current pulse frequency range of 100-5000 Hz. Detailed analysis of the coating microstructure, chemical and phase composition carried out by Scanning Electron Microscopy/Energy Dispersive X-ray Spectroscopy, Transmission Kikuchi Diffraction and X-ray Diffraction enabled the study of surface temperature evolution during the PEO process. Transient analysis revealed that at lower frequency, crystallisation of forsterite and grain growth trigger the thermal degradation and decomposition of HNTs due to the increasing temperature and thermal ingredients. In contrast, at higher frequency, the energy released is insufficient to induce forsterite crystallisation and incorporated HNTs are retained in their original tubular structure. Due to the fine porosity and good structural integrity, such coatings show enhanced corrosion resistance in saline solution. Strong correlations between surface thermodynamic conditions and evolution of coating microstructure disambiguate the fundamental mechanisms underlying incorporation of nano-particles into growing PEO coatings, thus creating the basis for efficient design of PEO processes and development of novel smart and multifunctional coatings with potential applications in many industrial sectors.