Nanoelectromechanical systems (NEMS) based on layered materials often rely on mechanical deformation, which involves relative sliding between layers. And the charge distribution between layers is essential for understanding its mechanical and electromechanical behavior. As a typical layered material, h-BN has a small energy difference between different stacks, so it is prone to phase transition under external force. That is, relative sliding between layers. Therefore, analyzing the effect of external forces on the electronic structure of h-BN is crucial for understanding the mechanical deformation of layered materials. In this work, Cu and Ni are used as substrate materials. On the one hand, the influence of different substrates on the electronic structure and stacking stability of h-BN is studied. On the other hand, the microscopic mechanism of the phase of h-BN on the Cu substrate is analyzed and discussed. Through analysis, the stacking stability of h-BN on a metal substrate depends on the hybrid strength of the metal 3d and h-BN p orbitals. That is the adsorption. In addition, the phase transition of h-BN on the Cu substrate is mainly attributed to the difference in the change rate of the total charge density of the h-BN/Cu interface between the two stacks with the external force. However, neither biaxial tensile nor biaxial compressive strain will cause h-BN to undergo transformation on the Ni substrate.