Coal gas is produced when coal is heated strongly in the absence of air during destructive distillation. This process breaks down the complex coal molecules, releasing volatile components that form coal gas, which contains hydrogen, methane, and carbon monoxide.