Science fiction writers use current technology and theories to develop their predictions and Scientists reading those far off predictions try to figure out how to make that happen. You'd be quite amazed how much tech we use on a daily bases got it start in the original Star Trek and someone went that's so cool I'm going to make that happen.
As others have said- a bit of both and sometimes just coincidence. Just as very similar stories can evolve concurrently in more than one persons mind- so can technology. The idea that something is cool or convenient for a writer to include in a story for instance. Just as a story can be made more efficient without people having to travel everywhere by foot, so can real life. Both the writer and inventor look at scenarios like police work or daily life and logistics and say: “You could do a lot more and wouldn’t need all these convoluted things if you could teleport...” It also stands to reason that many writers take existing technologies and improve or expand the ideas in fiction, and real world inventors are constantly doing the same- so an idea like wireless technology or autonomous machines is one both might have independently- but an example of real world influencing fiction. The inventor doesn’t grow up in a bubble though and are often inspired by fiction as well.
Unless they can see the future