Egi Kazuyuki was the son of a samurai in Iwakuni, Suō Province.
He attended the English School in Osaka and then began studying at the Sapporo Agricultural College and the Southern University (Daigaku Nankō).
He transferred to the engineering school of Ministry of Industry, which he had to leave in 1874 due to illness.
He then moved to the Ministry of Education and was initially a teacher at the Kaisei Academy in Arakawa, Tokyo.
In 1892 he moved to the Ministry of the Interior and became the secretary of Minister Inoue Kaoru.