Except for the magic/telekinesis at the end, the first part of this plot is strikingly similar to an early 2000s TV series called "John Doe", all about a guy who washed up on a beach and seemingly knew everything about anything asked of him except his own identity. He could speak any language, answer obscure trivia, understand complicated math/physics problems, and ended up solving crimes while trying to figure out where he came from and what the very fragmented memories he had were about.
It was kind of a cool show, but it was on Fox, so they barely supported it and then put a bullet in it after 1 season, just like basically everything else they aired around that time.