The Railway Museum in Omiya city (about one hour by train from Tokyo) is the enjoyable place for children and railways fans. It's a wonderful facility to enjoy the exhibitions of many formerly actually used trains in Japan. http://www.railway-museum.jp/en/
It is very popular among Japanese especially for children and railway fans in Japan. I recommend children and railway fans from abroad to visit there.
You can learn the history and technology of railway in Japan, enjoy the exhibitions of many previously actually used train cars, experience train operation using interesting simulators, etc.
The museum's big collection of formerly used train cars includes steam and diesel locomotives, and retired shinkansen (bullet train), passenger and freight cars. Many of them can be entered or viewed from under.
The eatery and rooftop garden provide nice views of trains in service passing by. There are also an outdoor jungle gym and play areas for children, as well as an area with small tracks and mini trains, which visitors can try to operate (additional fee applies).
In Kyoto, Kyoto Railway Museum is a very popular spot. http://www.kyotorailwaymuseum.jp/