A possible answer is that you have been breathing in unfiltered air that contains contaminants. These contaminants include dirt and dust particles. These particles mix with your snot and create black snot.
You most likely have dried blood in your nostrils. Remember where there is blood most likely there is bacteria. You might consider seeing your doctor to see if you have a sinus infection.
Black snot means that there is dried blood mixing with the mucus. That means there is a slow bleeding cut or a now healed injury up in the nose or head.
Either you are working with dirt or working around a sooty enviroment. You should clean your nasal passages with a netti pot and irrigate each nasal passage, until the water comes out clear.