The Pentagon said John C. Phelan is leaving his post at once, with Undersecretary Hung Cao set to serve as acting Navy secretary