Flies rub their hands (actually their front legs) mainly to clean themselves. They have taste and smell receptors on their legs and feet, and these can get covered with dirt and mucus from the surfaces they land on, which would interfere with their ability to sense and taste food correctly. By rubbing their legs together, flies remove dirt and mucus to keep these sensory organs clean and functional. This behavior also helps them maintain their ability to fly and stick to surfaces effectively by keeping their legs and feet clean of debris. Additionally, during mating season, female flies rub their legs faster to release pheromones to attract males. Thus, the main reasons for flies rubbing their hands are hygiene (cleaning sensory organs), aiding flight and movement, and mating communication.