Nagai continued his studies at Tokyo Imperial University and became the first doctor of pharmacy in Japan. He was sent under government sponsorship to Prussia in 1871 to study at the University of Berlin. He was the only civilian in a group of military students sent to study in Great Britain and France, and he traveled by way of the United States and Great Britain. While in Berlin, he resided at the home of Japanese diplomat Aoki Shūzō. He was influenced by the lectures of von Hofmann, and received a doctorate with a study on eugenol while working as an assistant at von Hofmann's laboratory. He decided to take up organic chemistry in 1873.
Nagai returned to Japan in 1883 to take up a position at the Tokyo Imperial University, and became Professor of Chemistry and Pharmacy there in 1893. His research centered on the chemical analysis of various Japanese and Chinese traditional herbal medicines.
While in Germany, Nagai married Therese Schumacher, the daughter of a wealthy lumber and mining magnate. On their return to Japan, she became a professor of German language at Japan Women's University, and was active in introducing German foods and culture to Japan. In 1923, Nagai and his wife hosted Albert Einstein and his wife during their visit to Japan. 
His son, Alexander Nagai, served as a diplomat at the Embassy of Japan in Berlin until the end of World War II.
As first president of the Pharmaceutical Society of Japan (PSJ, founded in 1880); Nagai had an important impact on the propagation of chemistry and pharmaceutical sciences in an industrializing Japan.