He did this in 1665 while looking at a thin slice of cork under a microscope. He observed tiny compartments that reminded him of the cells in a monastery, and thus he named them "cells".
However, it's important to note that Hooke only saw the cell walls of dead plant cells. The first person to see a living cell was Anton van Leeuwenhoek, who used a single-lens microscope to observe various microorganisms in pond water and other samples.