This is a good question. The letter M is the abbreviation of the French word Monsieur and is used just like the English abbreviation Mr. The abbreviation for Madame is Mme. The premise of the play M. Butterfly is that a man falls in love with and carries on a romantic relationship for many years with an opera singer. What the man doesn't realize is that the singer is actually a man disguised as a woman. Believe it or not, the play is based on a true incident.
By transforming the title of Puccini's opera Madame Butterfly to M. Butterfly, the playwright clues the audience in to the deception that the is revealed in the play. The title suggests that the opera gives us Mr. Butterfly's point of view. But we are presented with what seems to be a woman performing a woman's role. When we discover the true identity of the opera singer, we realize that it really is Mr. Butterfly!
I hope this helps.