As you probably know, the word “hermaphrodite” is derived from combining the names of the gods Hermes and Aphrodite. The name was first applied to one particular being, the child of these two deities, who had both male and female features. This has been a popular subject in art for some time, and it is thought that religious rituals to Hermaphroditos (then usually just called Aphroditos) on Cyprus involved men and women switching clothes. So why Hermes and Aphrodite? The two aren’t generally paired in classical mythology, with Aphrodite having been married to Hephaestus and having a long-standing affair with Ares. It was probably due to the particular association of these gods with sexuality, Aphrodite’s association with feminine sexuality being obvious, and Hermes often being represented with phallic statues known as herms. From what I’ve read, it appears that the first mention of Hermaphroditos being the offspring of these two gods is in the work of Diodorus Siculus, a historian in the first century BC. He also notes that some people thought of the hermaphrodite as sacred while others regarded it as grotesque, which I suppose is still true to a certain extent today.
The complete story of Hermaphroditos is known from Ovid, and how much of it he made up himself isn’t really known. The god was originally completely male, and indeed pretty much the epitome of masculine handsomeness. He was raised by nymphs, and when he reached adulthood one of them fell in love with him. This was Salmacis, the nymph of a fountain, and the attractive deity rejected her advances. When he bathed in a fountain, Salmacis embraced him and prayed to the gods that they would never be parted. The gods, who are big on irony, decided to interpret this by fusing the two into one being. From then on, anyone else bathing in that fountain would become hermaphroditic as well.