It’s an ancient Greek gesture that represents a phallus and implies/threatens penetration (which was considered degrading at the time).
@RedDeerGuy1 That is the putative origin of the V sign, not the finger. Also, the legend is that longbowmen had both their index and middle fingers cut off, not just the middle finger.
“Giving the big bird” is an old expression from the mid-1800s for hissing at someone (like a goose). The phrase was eventually shortened to “giving the bird,” and it acquired a more generalized meaning of “showing contempt.” As hissing at people fell out of favor, presenting one’s middle finger became the dominant way of “giving the bird.” By the 1960s, “giving” had evolved into “flipping” in reference to how the hand moves when making the gesture.