Gunpowder can be crafted at the Ammunition Work Bench from Dusting Sulfur, Stump Remover, and two Charcoal. It may also be acquired by harvesting Revolver or Rifle Ammunition (with higher chance of receiving them at higher Gunsmithing skill).
Gunpowder is used to craft Revolver Ammunition, Rifle Ammunition, or Noisemakers; it can also be used as an accelerant for starting campfires. One full can is enough to craft 50 ammunition (regardless of type), 5 noisemakers, or to accelerate 5 fires.
A large amount of pre-placed Gunpowder cans are located within Blackrock Prison, namely 2 can spawn on the catwalks/roofs leading from guard barracks to the infirmary, 1 is almost always located on the workbench and 1 is inside Cellblock C inside the guardroom near the cells. A large amount of Dusting Sulfur and Stump Remover are also scattered throughout the prison meaning even more gunpowder can be crafted.
At least 1 Gunpowder can will be located inside Last Prospect mine, usually located at level 2 on the bottom of the collapsed wooden stairs in the main room.
The in-game recipe actually creates black powder (considering ingredients), which in real life would be almost useless to reload any modern rounds due to much slower combustion and therefore lesser kinetic energy of bullets. Using ammunition crafted in that way could result in jamming of the barrel. Black powder also leaves a lot more residue in the firearm, causing the need to clean it more often.
In previous versions, a glitch was present where reloading save files or exiting/entering buildings would refill dropped cans of gunpowder to their maximum of 0.5kg.