Because the chemical piperine, an irritant, gets into the nose.
A sneeze is a reflex that is triggered when nerve endings inside the mucous membrane of the nose are stimulated.
Pepper, be it white, black, or green, contains an alkaloid of pyridine called piperine. Piperine acts as an irritant if it gets into the nose. It stimulates (or irritates) the nerve endings inside the mucous membrane. This stimulation will cause you to sneeze. Actually, the nose “wants” to kick out this irritant and the only way it “knows” how to do this is by sneezing.