Green Bottle Fly blowing a bubble
Why? It is not clearly understood and there have been lots of suggestions including cooling by evaporation, heating by solar gain, being sick, scaring away attackers, cleaning their mouthparts, and aerating or concentrating liquid food.
Scientists have investigated bubble-blowing in apple maggot flies. In experiments, flies were given dissolved food in various concentrations. After eating dilute food the flies broke off to sit quietly and "bubble." Then they returned to feeding. And then they stopped to bubble some more. The scientists suggested that bubbling was a way for flies engorged with dilute food to eliminate some water through evaporation, allowing them to go back and eat more.