The contact surface between a p-type and an n-type semiconductor is called a PN junction.
When p-type and n-type semiconductors are bonded, holes and free electrons, which are carriers, are attracted and bound and disappear near the boundary. Since there are no carriers in this area, it is called a depletion layer and it is in the same state as an insulator.
In this state, connecting the “+” pole to the p-type region, connecting the “-” pole to the n-type region and applying a voltage cause electrons to flow sequentially from the n-type to the p-type region. The electrons will first disappear by combining with holes, but excess electrons move to the “+” pole and current will flow.