Rising sun is a very important and respected symbol on the East. The legend says that the flag was invented by Buddhist monks. The flag was given to soldiers to help them in their fight with Mongol invaders. The legend about how this flag was invented comes from the idea that the emperor family comes from the divine sun.
First time the official flag of Japan was adopted in the XIII century when invaders from Mongolia invaded the country. The main idea why this flag was offered is to unite people under a distinctive flag.
The choice of the national colors can be explained in the following way:
Red is a symbol of life and energy of the sun. White stands for pure intentions and the absens of sins. The citizens of the country are loyal to the national flag. The flag is printed in each textbook because pupil must learn to respect the country and national symbols. The national flag was one of national symbols who never changed.