A dishwasher works by using hot water and detergent to clean dishes. It sprays hot water onto the dirty dishes and detergent helps break down grease and grime. Water is then drained away, and clean dishes are dried using a heating element or fan.