Before the massive success of A New Hope, the first film in what would be a long-running franchise that would impact all of film industry was simply called Star Wars. Naturally, the sequel was to be called Star Wars 2, which for a time, it was until it all became an epic space opera serial.
Check out the photo below shared on Reddit from what appears to be the Echo Base hangar set. Here, you can Harrison Ford in his Han Solo getup leaning on a ladder that had Star Wars 2 embedded on the side. Since the film started production by 1979, it would appear that creator George Lucas alerady decided to ultimately call it The Empire Strikes Back.
Harrison Ford on the Echo Base hangar set in "Star Wars: Episode V - The Empire Strikes Back". from r/StarWars
In fact, he knew pretty early on that the second film will be called that way. After the unexpected death of the first writer he commissioned (Leigh Brackett), Lucas had to write the story himself. He had multiple drafts by April 1978, in which he started using Episode in the titles to number the films.
Instead of Episode V, however, it was still actually Episode II at the time. It was when he developed that iconic twist about Darth Vader being Luke's father that he wrote up a new backstory for the villain and pushed the classic trilogy to a later timeline.
He created Anakin Skywalker as the man behind the mask, a Jedi apprentice of Obi-Wan Kenobi with a strong connection to the Force. He already knew from there that the two will eventually have a falling out and that their brotherhood will end on the site of a volcano with the former ending up horribly injured. This, of course, ended up being the Duel of Mustafar in Revenge of the Sith.
Lucas also already had the idea that Kenobi hid Luke on the planet Tatooine to keep him safe from the Republic, which he called the Empire. Being keen to explore this story in a trilogy, Star Wars 2 went from Episode II to Episode V: The Empire Strikes Back.
To reflect the changes, when Star Wars was re-released in 1981, a year after The Empire Strikes Back came out, it was retitled Star Wars Episode IV: A New Hope.
Why the behind-the-scenes photo still went with Star Wars 2 is unclear, but it may simply have been an attempt to keep what was planned for the saga or at least prevent from spoiling the title. After all, the original promotional materials only referred to it as The Empire Strikes Back while the opening crawl in the film showed it was indeed Episode IV.
Lucas himself didn't think that Star Wars would be the cultural phenomenon it became. However, he reportedly envisioned it as a serial from the get-go. He just thought that he wouldn't be able to make it until the success of the first film.
In a book by Denise Worrell called Icons: Intimate Portraits released in 1983, it is revealed that he had three trilogies in mind and the original trilogy sat in the middle.
The final Star Wars trilogy, which ended up being made by Disney, was drawn up to explore the moral and philosophical problems in the galaxy far, far away. The entertainment giant seems to be following what Lucas had planned by wrapping up the Skywalker saga in Star Wars: Episode IX.