On the whole star wars part, star wars is not quite science fiction, but more "Science fantasy", it's got all the same elements of a fantasy story just lasers and light sabres. Even has "Melee beats guns!" and "Jason vs goliath!" in it. A lot of people though don't like fantasy as it comprises often of unicorns, dragons and hobbits. Some people enjoy generic action movies but hate say lord of thee rings, probably because those to are fantasy. The matrix, even, can be seen as a more fantasy than a science fiction, because in science fiction the high-tech fancy stuff is actually very mundane to the characters.
Science fiction see everything is mundane, as a way of wowing the audience that "oh hey society moved on in this world we are looking into". Teleporters to the characters are boring, so are shuttles, warp speed ect. I mean heck the modern star-trek(well, modern star trek to me), westworld, has numerous science fiction elements inspite the "adventure" the main character goes on. Both star trek and westworld render the fancy high tech very mundane in the characters perspectives.
If star trek say had anything like a death star, the "death star" would be very, very common place and people wouldn't react the same way to it in the story. They'd be 'oh, another doomsday device the size of a small moon'. Star wars had a death star to make it feel more adventurous and fantasy like. Star trek's doomsday machine was more in response to the philosophical question of it's day with the presence of nuclear weapons and the "MAD strategy". In the episode the doomsday machine had already killed both it's own creators and whoever it's creators were threatened by. It isn't the actions of kirk which are a highlight in the episode, so much as the episode was focusing on WMD's, even the use of one(well, in practice) to stop a WMD.
Star wars is just not the same as other science fiction because, well, it never was science fiction, it was science fantasy.
I specifically referenced "scifi/fantasy" because of this general topic, but since you mention it: there aren't really any rock-solid definitions of science fiction and fantasy as they pertain to fiction, only historical norms and the obvious evocation the terms bring about. But I think the centroid of each type of fiction is best explained not by the trappings of the work but rather by the way the trappings are leveraged. Both science fiction and fantasy fiction rewrite the rules of the world. So called "normal" fiction will fictionalize details of the world, but they are generally set within the "real" world. If one day we build colonies on Mars, Martian colony stories will be "fiction" and not "science fiction."
The difference is in *why* a story rewrites the rules. So-called science fiction tends to rewrite the rules to examine how the world fills in those new rules. We rewrite the rules to say that warp drive exists, and now we see what the ramifications of that rule change are. Fantasy stories, on the other hand, tend to avoid actually examining the rule changes themselves, and instead explore the world the new rules creates. We rewrite the rules to say that hyperspace drives exist, and now we see what kind of stories we can tell about people who travel in hyperspace. It doesn't matter how it works or why it works.
We often tend to describe this in more simplistic terms: science fiction is about the science, fantasy is not about the science. One is about extrapolating the rules, and one is about exploring the world created with the new rules. When we are talking about Star Trek and Star Wars, it is easy to see that one is about science and one is not. But what about a story like the Time Traveler's Wife? In that story, the mechanics of time travel are not explored at all. There isn't really any science in the Time Traveler's Wife that I can recall. However, it is normally considered a science fiction story, not a fantasy story. Why? In my own opinion, that is because the central premise of the story invokes a rules change: someone can time travel, and in a very specific proscribed way. The story then focuses on the ramifications of this rule change. We explore how the rule change affects the lives of the people in the world that it touches. It focuses on how the main character's life is different because of this rule change. We don't explore the world created by the rule change. So even though the time travel mechanism might as well be magic, the story is still a science fiction one at heart.
We sometimes talk about science fiction in "hard" and "soft" terms and sometimes people assert that the "hard" science fiction is the stuff that is more "realistic." But I don't think that is a proper description. Stephen Baxter is often described as writing hard science fiction but his stuff is nowhere near being connected to the current state of understanding of science: it is highly extrapolative. I believe that when people talk about hard scifi being "hard" they are really describing how *deeply* the rules are explored. Hard science fiction explores its rules changes deeply, soft scifi explores them shallowly. It is the depth of exploration that makes hard scifi (when well written) seem "more real."
By these definitions, The Avengers movie is basically fantasy. It miracles into existence a lot of rules changes, but doesn't explore them. It invokes them, and then uses the resultant world as a playground. Even though Thor says what we call magic the Asgardians call science, that doesn't make the Thor movie a science fiction movie: it is a fantasy. It invokes rule changes and then explores the world created by the new rules. It doesn't explore the rules.
My definitions try to connect two things: the generally accepted ones, and two different motivations for writing "fantastical fiction." The two biggest reasons for changing the rules of the world narratively, as I see it, are to a) allow the reader to escape the real world and b) to comment or satirize the real world. A lot of the best historical examples of science fiction change the rules of the world specifically to compare and contrast with the real world. We want the reader to see the fictional world and draw parallels with the real one. Often, the commentary being done is very difficult to do when set in the real world, so science fiction becomes the metaphorical spoon full of sugar. Fantasy works can do this also, but less often in my opinion.
Of course, a single work can have elements of both, because they can address multiple narrative imperatives. Because much of the tools and scaffolding for both are similar, there is often a lot of blurring of the genres. Star Trek, for example, is in my opinion a hybrid work. Much of the time Star Trek is exploring the ramifications of the rules changes. What do people do when there's no more war, poverty, or disease, is the central tenant of "classic" Star Trek. Some episodes are also explorations of the rules change. What happens when you literally cure everything (The Mark of Gideon)? What are the limits of automation (The Ultimate Computer)? But a lot of Star Trek is just an exploration of the world created by the rules change. It is "science fantasy."
In my opinion, explaining how technology works is no different than explaining how magic works. Explaining science doesn't make a work science fiction. It is the why of the explanation that matters. If the way the transporter works is that it creates a pattern from your physical self and then recreates that pattern precisely, then what are the ramifications if it accidentally does that twice? What are the ramifications if it does that wrong? What are the ramifications when it does it at all? That's what makes fiction with science into science fiction in my opinion.
And I don't think it is coincidental that we have these two different narrative imperatives (explore the rules, explore the world created by the rules ignoring the rules) and two different kinds of metaphors used within those stories: science and technology, and magic. If you want to explore the rules, the rules have to "make sense" to the reader. They have to hold together with at least a semblance of common sense. That is basically what science and technology look like. If you specifically want the reader to ignore the rules, the best way to do that is to not have any structure to the rules. That is practically the very definition of magic: the world runs on rules we can't hope to make full sense of.