The dirt is gathered by the cloth, which is either attached to the accessory or held in your other hand. By passing through the fibres of the cloth, the steam creates a sort of electrostatic effect (similar to the process used by humidifiers) which is why dirt instantly attaches to the cloth and is retained.