The phrase "get the upper hand" means "to get into a stronger position than someone else so that you are controlling a situation."
One account has the phrase originating in the way that hands are placed one above another on the handle of a baseball bat to determine who takes the first pick for a team.
Another looks at the ways in which couples hold hands, with the taller person's hand on top.
The earliest origins of the phrase relate to distinctions in class, nobility and social status, using the original meaning of "hand" to include property.
In piano duets, the upper or right hand pair of hands is called the Primo, and the lower or left hand pair of hands is the Secondo. Typically the Primo carries the melody and so is most apparent to the non-expert listener.
Musicians insist nevertheless that the purpose of a duet is for each to complement the other, without one taking the lead.
Duet music is really ensemble music, and, as such, requires attention to how the parts fit together. Pianists often do not have much ensemble experience, and this is one major reason duets are excellent fare. The treble part is called primo and the bass part secondo. Usually, especially in simpler music, the primo has the melody and is simpler than the secondo.
Frequently the secondo part is interludes of boring oom-pah, oom-pah between bouts of sheer terror (such as scales in sixty-fourth notes in the key of 10 flats).
Quote from Martha Beth's Tips For Duet Playing link
Related: Duet Pedagogy