After the discovery of graphene, a lot of research has been conducted on two-dimensional (2D) materials. In order to increase the performance of 2D materials and expand their applications, two different layered materials are usually combined by van der Waals (vdW) interactions to form a heterostructure. In this work, based on first-principles calculation, some charming properties of the heterostructure constructed by Hf2CO2, AlN and GaN are addressed. The results show that Hf2CO2/AlN and Hf2CO2/GaN vdW heterostructures can keep their original band structure shape and have strong thermal stability at 300 K. In addition, the Hf2CO2/MN heterostructure has I-type band alignment structure, which can be used as a promising light-emitting device material. The charge transfer between the Hf2CO2 and AlN (or GaN) monolayers is 0.1513 (or 0.0414) |e|. The potential of Hf2CO2/AlN and Hf2CO2/GaN vdW heterostructures decreases by 6.445 eV and 3.752 eV, respectively, across the interface. Furthermore, both Hf2CO2/AlN and Hf2CO2/GaN heterostructures have remarkable optical absorption capacity, which further shows the application prospect of the Hf2CO2/MN heterostructure. The study of this work provides theoretical guidance for the design of heterostructures for use as photocatalytic and photovoltaic devices.