There's no telling when exactly this story first came into being. One thing's for sure: it got started way before anybody ever bothered to write it down. Like almost every myth, this tale was a part of the oral tradition way before it was formalized on paper. Of course, where Dionysus is concerned, nothing is ever all that formal (to say the least).
There are tons of different spins on this story, with tons of different cities and nations claiming to be either the birth or rearing place of the fabulous god of wine. (Hey, the dude was in demand.) Some scholars say that the fact that there are so many variations of the myth shows that Dionysus's cult actually absorbed the cults of similar gods throughout the Mediterranean world. (We bet those gods weren't too happy about that.)
Eventually, ancient writers got around to scribbling down the explosive story of Dionysus's birth, which includes the unfortunate death of his mother, Semele. One of the most famous versions comes in Euripides' The Bacchae, the brilliant tragedy starring Dionysus, himself, in which the D-man tells us the tale of his birth in his own words. Other big deal versions of the tale pop up in The Metamorphoses by Ovid and The Library by Apollodorus.