Star Wars is one of Disney's largest franchises, so it's hard to imagine today that the empire started as the passion project of this single dude. That guy, one George Lucas by name, saw the original Star Wars from script to screen as the director, producer, and even screenwriter.
Whereas his previous film, American Graffiti, was a callback to Lucas' past growing up in Northern California, Star Wars started as a callback to the films Lucas enjoyed while he was growing up. His original inspirations were science fiction serial films of the 1930s, such as Buck Rogers and Flash Gordon. In these films, courageous youths would battle evil empires and engage in fantastical adventures that usually resulted in a rescued damsel. Sound familiar?
As the story progressed, other Lucas favorites began to creep into the script. Japanese warrior movies influenced the Jedi, westerns gave us the famous Mos Eisley Cantina, and swashbucklers shaped the adventure. All of these genres "jumbled together in George's notes with all sorts of themes and techniques" (source).
However, the #1 greatest inspiration came from Lucas' study of mythology:
With Star Wars I consciously set about to re-create myths and the classic mythological motifs. I wanted to use those motifs to deal with issues that exist today. The more research I did, the more I realized that the issues are the same ones that existed 3,000 years ago. That we haven't come very far emotionally. (Source)
Lucas points to Joseph Campbell's The Hero with a Thousand Faces as a major influence, specifically the idea of the monomyth, a core narrative structure that all the heroic myths of the world follow. Lucas took Campbell's narrative structure and outlined his Star Wars script to it beat-for-beat.
The result was a script that was too large and too complicated for a single movie, so he decided to take the first third of the film and make it into a movie and save the remaining two-thirds for another day… and another box-office bonanza.
Lucas shopped a treatment around and found that nobody wanted his space story. Universal and United Artist passed on the film. Even Alan Ladd Jr., the Fox executive who ultimately backed Star Wars, didn't understand the pitch.
As Lucas remembers it,
I was fortunate there was one guy in the film business back when. He said, "You know, I don't understand your films. I don't understand your script. But I think you're a talented guy, and I'm going to invest in you." That was Alan Ladd Jr. at Fox. And that's how I got Star Wars made. (Source)
Writing the Sequels
After the original Star Wars, Lucas would shift from being a writer and director to being a producer and entrepreneur. While he has a story credit on The Empire Strikes Back and a writing credit on The Return of the Jedi, other writers helped Lucas draft both those scripts—Leigh Brackett and Lawrence Kasdan for Empire and Kasdan again for Jedi.
As a producer, Lucas would continue to devise story concepts and write drafts, but he handed most of the screenplay writing responsibilities to others. For example, Kasdan wrote the script for Raiders of the Lost Ark while Bob Dolman penned Willow… but Lucas conceived of both story concepts. Lucas remained the mastermind, even as other people took up the labor of creation.
Lucas wouldn't return to exclusively writing screenplays for films he would direct until he undertook the Star Wars prequels, two decades after the first Star Wars film.