Dmitry Ivanovsky discovered viruses in 1892 while studying tobacco mosaic disease. He found that the infectious agent could pass through filters that trapped bacteria, leading to the discovery of a new class of microorganisms smaller than bacteria - viruses.