Ex-submarine officer chiming in…
I would concur with most of what has been mentioned already.
Here is some guidance:
To become a U.S. submarine Commanding Officer (CO), you need to be a line officer.
Assuming your friend is currently in high school, I would recommend the Naval Academy or NROTC. Trying to get into an officer program once enlisted can be very difficult, despite what a recruiter might tell you.
Once in an officer program, you need to look forward to securing an interview with the four-star Admiral in charge of Naval Reactors (NR). To accomplish this, you need the best grades you can achieve, preferably in a branch of engineering. Majoring in a hard science is less desirable, and typically requires higher grades. Majoring in liberal arts is not very desirable, though I have seen it happen. NR would like some assurance that you will complete the nuclear power training curriculum.
Personal anecdote: I was in an NROTC program majoring in engineering at a school with a reputation for rigorous grading. Due to this (and immaturity), my grades were about C-average for the first half of college. For the last half, I made the Dean’s list every semester. I submitted a package for a nuclear interview three times. My rising GPA, combined with high SAT scores, finally got me an interview. Most of my interview with the admiral was concerned with my academic performance.
Once commissioned, through the year-long nuclear training program, followed by the three-month Submarine Officer Basic Course, you’ll be assigned to a submarine. Your performance as a submarine junior officer (JO) pretty much sets the stage for the rest of your career (or lack thereof). A fine balance is required between having the authority of an officer while learning from the far more experienced senior enlisted personnel. You have to do your assigned division officer job, stand watch on a rotating-shift basis, and complete your quals in a timely fashion. You have to learn to function on very little sleep.
All that being said, there is little to compare to being the Engineering Officer of the Watch (EOOW), in charge of an operating nuclear reactor, at age 24. Shortly thereafter, you’ll qualify as the Officer of the Deck (OOD), in charge of the entire submarine. (Of course, the ship’s Engineering Officer and CO are also on board.) Once you finally qualify in submarines and receive your gold dolphins, your path to becoming a CO will be clear.