Why is there a fly in my pants?
Solution 1:
From etymonline:
fly (v.1)
Notion of "flapping as a wing does" led to noun sense of "tent flap" (1810), which yielded (1844) "covering for buttons that close up a garment."
Wikipedia says:
In the 1930s, a sales campaign began for children's clothing featuring zippers. The campaign praised zippers for promoting self-reliance in young children by making it possible for them to dress in self-help clothing. The zipper beat the button in 1937 in the "Battle of the Fly", after French fashion designers raved over zippers in men's trousers. Esquire declared the zipper the "Newest Tailoring Idea for Men" and among the zippered fly's many virtues was that it would exclude "The Possibility of Unintentional and Embarrassing Disarray."[citation needed]
The word fly is commonly used in the UK as well.
More here.
Solution 2:
One of the meanings given in the OED:
A flap is:
Something attached by the edge. Cf. flap
A strip or lap on a garment, to contain or cover the button-holes; hence something used to cover or connect (see quot. 1884). spec. (freq. pl.) the piece of cloth that hides the fastening at the front of a pair of trousers; also, the fastening itself.