Trash-talk is a form of boast or insult commonly heard in competitive situations like sporting events. It is often used to intimidate the opposition, but can also be used in a humorous spirit. Trash-talk is often characterized by use of hyperbole, or figurative language. It may also be referred to as sledging. Trash-talk was commonly used by the heavy-weight boxing champion Muhammad Ali in the 1960s and 1970s. Since then, it has become common for boxers, wrestlers, and other sports competitors to use trash-talk. Trash talking in amateur sports ranks is generally discouraged and frowned upon (especially in youth leagues).
Trash-talk is very effective in many sports such as basketball, because a lot of the professional athletes do not have a proper education and are illiterate coming into the league as their entire childhood life is spent playing the sport. So many athletes use this technique to get under their skin, which in turn effects their performance during the game. It usually leads to loss of focus or getting annoyed/angry and trying to retaliate in such ways that player X(the one who is talking trash) wants you to react. Trash-talking or sledging can extend from making fun of the person's hair to insulting one's family. Trash-talk has been adapted and changed over generations during the game of basketball. It was probably the greatest during the 80's and 90's, while the best like Michael Jordan, Larry Bird & Reggie Miller were playing.
Trash talking only makes if you're a good player. If you're just an average player and start talking smack, it won't really affect you as it wouldn't bother you as much, but when players like Michael Jordan and Reggie Miller do it, it changes the whole dynamic of the situation as you usually take it seriously and want to try and prove them wrong. This is what players take advantage of and continue talking to help instigate the behavior and change the state of mind of player X.