I lived in Tokyo for three years from 5th to 7th grade. However, my experience is different because I went to an international school where we were required to speak English. While I may not have the best experience there, there's still plenty to like about living there.
It's not a great idea to generalize all Japanese as disliking foreigners. True, there might be some racists, but you can find some anywhere in the world. People think Japanese people in general dislike foreigners in general because generally people there don't know how to deal with foreigners. In bigger cities, it's not as much of a problem because you can find other foreigners there, but you might get stares if you go to the countryside or something. I took two years of Japanese classes and never got good at it, but I could still get around because of some English signs or using basic words and gestures. Also, a lot of words have been adopted from the English language like foods and stuff so you should be fine with western food.
Also, generally younger city kids will more likely find foreigners cool, so while you might deal with some troublesome people, some people will be much nicer to you. Still...I'm ethnically Chinese-Taiwanese so I probably wasn't treated as a foreigner unless people noticed I didn't really speak Japanese or they knew me. I think moving to a different country and culture would be a great experience, and it may be something you'd appreciate more as you get older...I know I regret not appreciating it as much when I lived there compared to after I moved back to America. I was definitely hesitant about moving there when I first found out, but if I could, I would encourage my younger self to take advantage of it.