The title role in a play or an opera is the role (the part) which is also the title of the play or opera. We say that the actor, singer or dancer who performs that part has the title role. For example: in the opera Carmen by Georges Bizet the part played by the girl called Carmen is the "title role". We may say that a singer took the title role in the opera Carmen. That means that she sang the part of Carmen in the opera.
The title role is not necessarily the most important role in the play or opera, although it often is.
A few other well-known examples in which the performance is named after one of the characters include the operas Aida (by Giuseppe Verdi), Madame Butterfly (by Giacomo Puccini) and Peter Grimes (by Benjamin Britten), the ballets Coppélia (by Léo Delibes) or Petrushka (by Stravinsky), or the plays Othello or Hamlet (by William Shakespeare).
The title character in fiction is the fictional character whose name is in the title (or suggested in the title), such as Harry Potter in Harry Potter books by J.K. Rowling, or Simba in Disney's The Lion King (Simba is the Lion King).
"Title character" always refers to a fictional character.