Harcourt Fenton "Harry" Mudd was a notorious con artist encountered on numerous occasions by the crew of the USS Enterprise. Essentially more of a rogue than a true villain, he lived by his wits on the other side of the law.
Before the Enterprise first encountered him...
Mudd's interstellar exploits began when he deserted his nagging wife, Stella, on Earth sometime in the mid-23rd century, and became a peripatetic grifter who roamed through the galaxy practicing various cons, schemes and scams--not always successfully. By 2266, Mudd had already been convicted of smuggling (receiving a suspended sentence), transporting stolen goods, and purchasing a space vessel using counterfeit currency. For these last two crimes, Mudd was sentenced to undergo psychiatric treatment, the effectiveness of which was officially disputed. He held a Master's License permitting him to legally operate a spacecraft, but this license was revoked on stardate 1116.4 for operating stolen spacecraft and transporting illegal goods.
When the Enterprise first encountered him
In 2266, Mudd, using the illegal Venus drug, attempted to sell Eve McHuron, Ruth Bonaventure and Magda Kovacs to a group of lithium miners led by Ben Childress on Rigel XII. The drug gave the impression that the three women were beautiful, when in fact they were not. Childress and the other miners married the women anyway, as they were more interested in companionship and the benefits that having three practical, intelligent women around could provide, and the women were happy to escape their previously lonely existence. However, criminal charges were pressed against Mudd for his actions and he spent at least some time in jail. (TOS: "Mudd's Women")
After the Enterprise first encountered him
Somehow though, Mudd soon escaped. He then promptly began to sell the plans for alien technologies to various worlds--without bothering to pay any royalties to the actual off-world patent holders. This ended when an attempt to sell a Vulcan technology to the inhabitants of Deneb V backfired. The transaction was unmasked as a hoax when the Denebians actually contacted Vulcan to ensure that Mudd had the rights to sell the technology in question...which rights, of course, he lacked.
His second encounter with the Enterprise
The penalty for fraud on Deneb V is death. However, Mudd managed to "borrow" a spaceship and escape before the sentence could be carried out. He ended up fleeing to a previously uncharted planet, one that was populated entirely by androids, programmed to adapt the planet for productive use, who became interested in studying Mudd as a specimen of Humanity. This meant that while the androids attended to his every need, and even made him the titular ruler of the planet (later named Mudd in his honor), Mudd was not allowed to leave.
Mudd then attempted to broker a deal where he would be allowed to escape, if he provided the androids with other prime Human specimens to study. Therefore, in 2268, Mudd identified the starship U.S.S. Enterprise to the androids as a likely source of exceptional examples of Humanity. (Mudd had no idea at the time that the androids instead planned to take over the galaxy and make all organic sapient races so totally dependent on them that they could effectively enslave these races.) Subsequently the android known as Norman, posing as a member of the Enterprise crew, successfully took control of the ship and took it to the planet Mudd. The crew of the Enterprise, however, was able to escape captivity by identifying Norman as the control for all of the planet's androids. The crew proceeded to confuse Norman with illogical behavior, causing him to break down. Mudd was left behind on the planet, with a number of android replicas of his shrill wife Stella for company. (TOS: "I, Mudd")
His third encounter with the Enterprise
Eventually, Harry Mudd stole another spaceship and escaped the androids' planet in 2269. He traveled to planet Ilyria VI and "sold" Starfleet Academy to its inhabitants. Mudd then used the proceeds of that con to travel to Sirius IX where he discovered a love potion crystal that he sold to over a thousand of the planet's inhabitants. Unfortunately, the buyers suffered allergic reactions to the crystals, and Mudd was forced to flee to the mining planet Motherlode, where he also tried to sell the love potion drug. Once again, however, he encountered the crew of the Enterprise and was captured by Captain Kirk and Spock.
Mudd was incarcerated in the brig, where he gave the love potion to Nurse Chapel as a gift. She then took the potion to Spock, but found that it did not take effect immediately; as a Vulcan, the effects of the drug took longer. Later, the drug did affect him, and Spock fell in love with Nurse Chapel. Fortunately the drug only had temporary main effects--and a rebound after-effect. After yet another escape, Harry Mudd was again captured and sentenced to an indefinite period of rehabilitation therapy, without guarantee that it would be effective. (TAS: "Mudd's Passion")
In the alternate reality, in 2259, the USS Enterprise possessed a small ship that was confiscated in "the Mudd Incident" about a month before their assault on Qo'noS to capture John Harrison. (Star Trek Into Darkness)
The character of Harry Mudd, as devised by writer Stephen Kandel, was inspired by the fact that NBC had announced fears that the first Star Trek pilot episode, "The Cage" (with its alien Talosians), would not be understood by its audience. Kandel later recounted, "I said, 'What if we start with a character who isn't alien or highly technologized, but rather somebody with whom the audience would easily identify?' What we came up with was a roofing salesman, a con man." (Starlog issue #117, p. 44) "I originally had the idea of a kind of a traveling salesman and con man - the medicine salesman in The Wizard of Oz, that ends up as the Wizard, an interstellar con man hustling whatever he can hustle; a lighthearted, cheerful, song-and-dance man version of a pimp."
Kandel was given the chance to develop one of Roddenberry's outlines, "The Women", which was basically about 'space hookers' bound to be sold as wives on a distant planet by an 'intergalactic pimp', named Harry Patton. Kandel felt the story lacked a focal point character, and merged it with his idea of the charismatic con man. (These Are the Voyages: TOS Season One, p. 43, 133)
According to an early draft  of "Mudd's Women", Harry Mudd was born on Antares Pi Four and was 47 years old. This would place his birth at about 2219, making him the same age as Doctor Richard Daystrom.
Stephen Kandel was highly proud of having conceived of Harry Mudd. "Harry Mudd was a marvelous character because of the highly recognizable human quality set against the alien-in-time or alien-in-space activity that evolved," Kandel remarked. "That's what made it amusing, and it's also hard to do because you had stern-jawed Kirk who would meet an eight-foot intelligent reptile and deal with him as any astronaut would. Then, the reptile would meet Harry Mudd, whose first impulse would be to run and hide, and second impulse would be to sell it scale enhancer." (Starlog issue #117, p. 44)
Harry Mudd was performed by actor Roger C. Carmel in the three episodes he appeared in. Stephen Kandel was impressed with the actor's performances of the role, enthusing, "Roger C. Carmel was wonderful as Harry. He inhabited the character and expanded it [....] He developed the character physically as an actor [....] He WAS the character to such a large degree that no one else could possibly play the part." (Starlog issue #117, p. 44) "It was an ideal part for him," Kandel also commented, and related that he believed the role fit Carmel to such a degree that the actor was slightly frustrated that the other roles of his career failed to measure up to it. (The Star Trek Interview Book, p. 134)
In Mudd's mug shot, he appears to be wearing the same clothing he wore when he was transported onto the Enterprise and, as frequently happens on Star Trek, the picture is reversed.
The Art of Star Trek contains a photo of a raktajino bottle from Quark's Bar which bears a label stating: "100% Colombian," "Made from the Green Hills of Earth" (a title of a short story by Robert Heinlein), and "Imported by Harcourt Mudd." If this is canonical and refers to the same Harcourt Mudd, it would indicate that Mudd entered into this business sometime after the First Khitomer Accords and his original misadventures with the crew of the Enterprise, because raktajino was unknown to the Federation in the 2260s, as documented in DS9: "Trials and Tribble-ations".
With the exception of those actors who played members of the Enterprise crew, Carmel was the only actor to play the same character in more than one episode of The Original Series.
Along with Khan Noonien Singh, Mudd is one of only two opponents to face Kirk more than once in live-action Star Trek productions.
Kirk encountered Mudd again in 2268 between the events of "I, Mudd" and "Mudd's Passion". He was discovered on a salvage mission of a derelict ship of unknown alien origin. While aboard, he managed to accidentally sell weapon components to pirates, become infected with unknown alien drugs, nearly kill the Enterprise landing party with faulty equipment, and destroy a priceless archive of computer records. Following the conclusion of his investigation, Captain Kirk ordered Mudd to donate five of every artifact he found to research. Also, Lt. Uhura arranged for Mudd to meet his "long-lost wife" at a nearby starbase. (Star Trek: 25th Anniversary) In the CD version, his voice was provided by Tom Wyner.
Mudd later purchased a planet for its rare ores, but found, to his dismay, that the planet was actually a large egg for a space-faring creature. After it hatched, Mudd sold the planet back to its original owner (who was unaware of the creature), but he still ended up losing out as the ores were then floating in space and were actually easier to mine. (US comic strip: "It's a Living")
Other appearances include Where Sea Meets Sky, Mudd in Your Eye, "The Business, As Usual, During Altercations" (from Mudd's Angels), "Operation Con Game", "When You Wish Upon a Star...!", "Mudd's Magic!", "Mission: Muddled", "The Sky Above... The Mudd Below", and "Target: Mudd!".