Because the priests were very influential people. The favor of the Gods depended on the priest. It was the priest who brought sacrifices to the Gods and knew all the necessary prayers.
The priests were very educated people. They were trained from the age of five. They knew how to read, write, count. They watched the movement of the stars in the sky and kept a calendar according to which life in Ancient Egypt was built.
Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.