In the current work, density functional theory is used to explore every attribute of the 2D AlN/GaN nanoheterostructure. To characterize the electronic exchange-correlation, we used the PBEsol functional. In order to prevent any interlayer contact between periodicity of images, a vacuum is produced along the z-direction of approximately 10 Å. To increase the precision of bandgap prediction, the electronic and optical characteristics were computed using the meta-GGA lmBJ functional. To account for interlayer van der Waals interactions, nanoheterostructure computations were performed using the DFT-D3 functional.