The earliest version of the story of "Cupid and Psyche" that's still around today was originally written down by a Roman guy named Apuleius sometime during the 2nd century AD. The tale is included in Apuleius's novel entitled The Golden Ass. (No really, that's the title.) It's about a dude named Lucius who gets turned into a donkey (an ass) and has lots of crazy adventures. (Well, it's about a lot more than that, really.)
What's funny is that the story of "Cupid and Psyche" is included as a digression in The Golden Ass; it's a side story whose only purpose is to add meaning to the larger story at hand. Psyche's struggle to be worthy of her godly lover, Cupid, is used as a metaphor for Lucius's struggle for the divine. On that note, the story of "Cupid and Psyche" is often seen as an allegory for every human being's struggle for love and happiness. The trials that Psyche faces represent the hardships that all of us face in life. (Read more on this in "Symbolism, Imagery, Allegory.")
Even though Apuleius's spin on the tale is the earliest one that's still extant (still around), that doesn't mean that he was the first to write it down. There's no telling how much ancient literature has been lost to history. Also, it's pretty clear that Apuleius didn't just make the story of "Cupid and Psyche" up on his own. More than likely, it was a myth or folktale that had been told in many different ways for many different years by many different people. The basic idea of the story still pops up all over the place in lots of different forms. For example, "Beauty and the Beast" has many similarities to the tale "Cupid and Psyche."