Step 1: Understanding the Concept
When a p-n junction forms, electrons and holes diffuse across and recombine, leaving fixed ions near the junction.
Step 2: Depletion Region
Positive donor ions remain on the n-side and negative acceptor ions on the p-side.
Step 3: Barrier
These accumulated positive and negative charges create a field and hence the potential barrier.
Final Answer:
The potential barrier is due to accumulation of positive and negative charges near the junction.
\[ \boxed{\text{(D) }\text{accumulation of positive and negative charges near the junction.}} \]