This is a book I remember getting from the library in middle school, around 2008, but haven't been able to find again since. I think it was reasonably new. I read it in English, but I don't know if it was ever published (or originated) in other languages. I asked about it on the TV Tropes "You Know That Show..." forum, but never got any responses.
The prologue has someone perform a powerful and dangerous spell that involves crossing two wands in front of the caster. They do it while in a spaceship in space, which is supposed to be impossible because there is no magic in space.
The main character is a teenage boy who is chronically ill. One day a weird girl appears, having gotten lost on an inter-dimensional field trip from a parallel universe version of Earth to a different parallel universe. The main character introduces her to burgers, at the Hard Rock Cafe, where she eats a ton. After eating she is dismayed to learn that hamburgers are made of meat, with the knowledge making her feel sick, as it turns out her entire society is vegetarian and she assumed Earth's was as well. Throughout it all she is abnormally hyper, apparently even for herself, and notes that her magic-powered inter-dimensional transport device is charging up way faster than usual.
She ends up bringing the boy to another parallel universe, but something goes wrong with her transport device again and they end up in one where there is no magic at all, so her device cannot recharge, leaving them stranded. However, the boy stops feeling sick, and is now somehow able to use magic (even though there doesn’t seem to be any around). The dominant race of “People” on this world make slaves out of a "lower species" of humanoids called “Trogs” (short for troglodytes, I think). A popular local food consists of cat-sized spider-like creatures. The boy and girl end up staying with a family, and the boy is sent to a low-level class at the school due to his lack of knowledge about the world. He accidentally casts a translation spell when asked to read an ancient tablet with a picture of a Trog carrying a Person, and reads something about the Trogs and People working together. The teacher believes he is making it up, as the locals have translated it (incorrectly) to reflect the Trogs' "inevitable" servitude.
At some point, the girl tries to teach the boy a party trick that makes a small flame come out of your thumb; when the boy tries it, he gets a massive pillar of flame somewhere from 20 to 50 feet high.
The locals are bad at shape recognition, and the boy breezes through a carnival game where he identifies drawings of several things, including a duck. One of the last ones requires multiple guesses, and I believe he tried castle before correctly trying City Hall. The mayor, who enjoys such games but isn't very good at them, congratulates him. The boy later tries to teach the people he's staying with how to see constellations in the night sky.
At some point, they end up underground trying to fix the world's magic. The hand-sized spiders that are eaten on the surface have giant cousins below, and while being chased by a multitude of the giants, the father of the family they stay with promises to never eat one again. They find a hologram of a woman who tells them what happened to the magic. Many years ago, there had been an attack of lizard-like creatures. They almost wiped out the People and Trogs, so (still working together back then, as the social stratification hadn’t happened yet) they built a machine that would use magic to stop the lizard-creatures. However, they left it powered on but inactive, and it just kept storing up magic without using it, until there was no free magic left. The lizard-creatures are coming back again now, and the main characters can activate it once more, but the main girl's ancestors were descended from lizards, not primates, so she is afraid the device will hurt her as well. They have no choice, though, as some of the lizard-creatures are down here and coming after them, so they decide to activate the machine. It stops the lizards and the girl is mostly okay.
With the magic released, they make it back to the girl's home world, where she tries to tell a board of magic officials or something about the boy's strong abilities. They scoff, so she gets him to demonstrate. They are in a room where the magic level can be adjusted, and made visible. He tries to do the flame-from-thumb spell, but since he can only do magic where there isn't any, he gets only a tiny spark. A particularly dense cloud of magic drifts over him, making him sneeze and causing the spark to go out. The adults scoff again, but one is more open minded. He makes the magic in the room invisible again, but also turns it down to zero so there isn't any in the chamber. He then gives the boy two wands and asks him to perform the dangerous, powerful spell that appeared in the beginning of the book. The others find this entertaining until the boy casts it easily. The man throws the magic level to full power and stops the spell before it kills everyone, and the others decide to be a bit less hasty. The eventual consensus is that our Earth has so much magic energy that everyone has become immune to it, which is why we aren’t aware of it, except the boy’s immune system overreacts and that’s why he feels sick around magic. But he’s so saturated in magic from living on Earth that, when he’s not surrounded in it, he can use his internal supply of magic energy to cast spells.
At one point, I believe the boy also uses magic while in a ship traveling in a tunnel between the worlds, where there is no magic, to destroy someone bad who is following them. But that might just be what happens in the prologue getting mixed up with the other details, I'm not at all confident about this part.
The book ended with a sequel hook, but I don't know if any sequel was ever published.