The basic meaning is to mishandle a situation.
In card games, such as poker, there are multiple strategies available for the same cards. For example, a strong hand such as four aces could be played as a strong hand or as a weak hand (to deceive others so that they keep betting and as a result the player with four aces wins more money).
"I didn't play my cards right" has the general sense of mishandling an opportunity that could have turned out well. Often, the underlying cause is a lack of initiative (not taking the opportunity), or lack of diplomacy or social skills (creating relationship problems), or lack of salesmanship or persuasion skills (failing to convince others of the merit of your position).
In life, there are situations such as being qualified for and missing a job promotion where the person or an observer could say: "I didn't play my cards right."/"You didn't play your cards right."