AlladinAladdin has a ghostGenie. He can talk to that ghostgenie, and ask for things. That's magic.
Captain Kirk has a computer-controlled replicator. He can talk to it and ask for things. That's technology.
So what's the difference? Well, the difference is that we are made believe that the replicator/computer is built by and completely understood by humans, and follows the known laws of the universe. While the ghostGenie just exists, and his magic abilities are not understood by humans.
Now you might say, the ghostGenie has a personality, the Star Trek computer controlling the replicator doesn't. But then, Data does have a personality, as has the Emergency Medical Hologram. And yet, both are considered technology, not magic.
So the difference between technology and magic is whether you think it needs some supernatural powers to work.
Thus whether relatively primitive people would "confuse" technology with magic would very much depend on how they learn about it, and their general mindset about such things.
As of how much the mindset matters can be seen with people who claim to have supernatural abilities today. Believers tend to believe those people have the abilities even after they have been shown that such abilities can be faked (noting that the fact that you can fake them doesn't proof that their Guru faked it). While non-believers will be sure it is a fake even if they have no clue how those people did it.