One thing in world-building is that a lot of writers -- particularly those with cross-world travel in their worlds -- say that just as magical does not work in mundane worlds, so too does "technology" not work in the magical world. Just because the world's magical. Or, in a single world, the presence of magic causes technology to fail.
It does not work. The other way round can also be an issue, the way magic just does not work in other worlds, but that's another essay.
If your gunpowder doesn't explode, you should be dead, and your fire shouldn't burn. They all run on the same process of combustion.
If your watch doesn't run, lightning shouldn't strike -- or else that mill shouldn't grind grain, and the carts going to it should not have their wheels turning. Whether your watch is electronic or clockwork would determine that.
Technology doesn't use some fundamentally different processes than everything else. That, perhaps, is the best distinction that you can use to have both technology and magic in a story: magic depends on intent, but technology consists of pointing a natural process in an artificial way, and intent is irrelevant to consequences except insofar as you successfully guide it. Failure to guide it correctly has caused many disasters as nature takes its course.
And, anyway, what is technology? Why is the steam engine technology and the water mill not? The knife knapped out of flint uses techne as much as the most advanced rocket.
And worst of it, this inability almost never caused. It's treated as a natural aspect of magic. As spontaneous as the sun rising. Selectively turning off the laws of nature only for human-generated things, and at that, only for certain applications developed after a certain era (in our world) leaves the question of why. Not to mention that this restriction operates more like technology than magic. (Hmm. How would one use the difference in machine operations? I don't know, but I suspect someone would try.)
Occasionally it is given more or less of a reason. Localizing the problem to electronics (as in Dresden Files) helps make it seem more coherent because it could be something specific to electronic devices. One work (Rivers of London) explains that electronic devices, like living beings, generate a field that can be used to power magic, but while living beings can't be drained without being sacrificed, the magic alone will drain devices.
There's other alternatives. In L. Jagi Lamplighter's Rachel Griffin series, there is conflict between them -- and research going on to find out why.
And what if the problem were magic? That can turn on intent. There may be no scientific distinction between a fire and a gun, but human beings can draw a divide. And often do.
On the other hand, turning off technology would be an enormously powerful magic. Someone who not only cared passionately enough to expend all that power and was powerful enough that it mattered -- or worse, someone for whom it was trivial -- would be worlds-shaking because he could shake all of them. Even in a single world -- even if he influenced only one planet on it -- this is a character who leaves a long shadow. How plausible is it that he would do only this thing? Even if he did, how could anyone know that? It would cast a shadow over everything.
More people to do the work would raise the quantity of power -- at least plausibly -- and perhaps explain why it was not wielded again, since they would need to combine to do it. Then, there would need to be some reason why they combined to do in the first place.
Perhaps a charismatic wizard had persuaded them to do it to create a place of experiment, or as an act of war, and had perished in the process, thus frightening them off from more acts of that kind and leaving them with no one to inspire them to act in concert.
It would have to be a truly powerful desire. Perhaps a war but if so a desperate one, a war of extermination perhaps.
Or, perhaps, the intents conflict. Technology is worked with intentions, even though the intention does not determine the end result. Perhaps there are graduated degrees of worlds where magic is more and more powerful, and technology is less and less so, down to the world where you can't knap flint into a knife.
Perhaps in a single world, the magic would be a thing of wild places, where little technology has imposed its intent.
There's a lot of work in making that convincing. There's a lot of work making any of them convincing.
If you just want to get rid of modern electronics, you can simply postulated magically generated E-M pulses.
Thanks for pointing this out - something that needs to be told more often. It is such an obvious flaw in the story when I see in fantasy stories where technology doesn't work but the natural laws used by this tech are still present. It just tells me that some people have no idea how technology works.