Instructions
Go to Tom Nook's Shop. The exact location varies from game to game, but he's somewhere in town.
Speak with him to see his inventory. If you're lucky, he's selling a net. If not, return on another day.
Equip the net by pressing the "A" button.
Approach the fly slowly. If you move too quickly, it will buzz away.
Push "A" to swing the net. Repeatedly tap the button to improve your odds of catching the fly. If it gets away, slowly approach it and try swinging your net some more.