When navies began transitioning from sail to steam power, coal-fired engines were the norm. Wood wasn't efficient enough to power a ship, and oil fired engines were decades away.
Coal was dirty, and loading it was always an unpleasant task. The crewmen feeding the furnaces became known as "black gangs" due to the coating of coal dust the stokers would inevitably become covered in. Besides that, it was also hazardous, both from breathing it in, and from its tendency to spontaneously combust. Many ships were sunk from the explosion of magazines, triggered by fires in coal bunkers, including HMS Bulwark, HMS Vanguard, Japanese battleship Mikasa, and USS Maine.
Oil fired boilers became available in the late 1800s, but would not see widespread adoption aboard capital ships until the 1920s, when navies were able to obtain sufficient stockpiles of the fuel.