Warning: There are no spoilers in this post, but there are in the linked source material.
Many commentators on science fiction assume that science fiction should accurately explain science because it is teaching people about science. But, usually, it isn't doing that, so accuracy isn't the point. This doesn't mean that there is no relationship between science and science fiction. But, it is as much about eternal narratives and cultural alternatives, as it is about hard science, in many cases.
From 4gravitonsThe a movie like Avengers: Endgame doesn’t teach science, or even advertise it. It does celebrate it though.That’s why, despite the silly half-correct science, I enjoyed Avengers: Endgame. It’s also why I don’t think it’s inappropriate, as some people do, to classify movies like Star Wars as science fiction. Star Wars and Avengers aren’t really about exploring the consequences of science or technology, they aren’t science fiction in that sense. But they do build off science’s role in the wider culture. They take our world and look at the advances on the horizon, robots and space travel and quantum speculations, and they let their optimism inform their storytelling.