In 1916, at the age of 16 and after completing his junior year in high school, he was appointed to the United States Naval Academy at Annapolis in Maryland, along the Chesapeake Bay. Because of World War I, his Class of 1920 was graduated a year early – on June 6, 1919. Cunningham was commissioned an ensign in the United States Navy and his first assignment was on the naval transport , which brought troops home from France. He would then spend the next two years on ships off the coast of Turkey in the Aegean and Mediterranean Seas. In January 1922, aboard the , he sailed for China where he would spend the next year and a half. Returning to the U.S., on May 3, 1923, he was promoted to lieutenant (jg), with his promotion backdated to June 7, 1922.