Baya (SS-318) was launched 2 January 1944 by Electric Boat Co., Groton, Conn.; sponsored by Mrs. C. C. Kirkpatrick, wife of Lieutenant Commander Kirkpatrick; and commissioned 20 May 1944, Commander A. H. Holtz in command.
Baya arrived at Pearl Harbor in August 1944. During 23 August 1944 – 25 July 1945 she completed five war patrols in the South China Sea, Gulf of Siam, Java Sea, and Philippine Sea. Baya sank four Japanese vessels totaling 8855 tons and an 8407-ton passenger-cargo ship in conjunction with .
Baya departed Subic Bay, Philippine Islands, in September 1945 and arrived at San Francisco on 24 September. Shortly thereafter she began inactivation and on 14 May 1946 went out of commission in reserve at Mare Island Naval Shipyard.
Baya was recommissioned 10 February 1948 and converted to an electronics experimental submarine. Reclassified Auxiliary Research Submarine, AGSS-318, 12 August 1949, Baya has since conducted experiments for the Naval Electronics Laboratory San Diego, Calif., participated in local operations near San Diego; and has served with the joint American-Canadian Task Force gathering scientific data off western Canada in November and December 1948. During July–September 1949 she made a cruise to the Arctic to gather valuable scientific data in the Bering and Chukchi Seas. Between July and October 1955 she was deployed to Pearl Harbor on further experimental research.
During 1958–1959, Baya was completely reworked at Mare Island Naval Shipyard to test LORAD, an experimental long-range sonar. The forward torpedo tubes were removed and replaced by a blunt bow with a mushroom anchor in the bottom of the hull. A section was added between the former Forward Torpedo Room and the Forward Battery compartment, with quarters for twelve scientists. These modifications increased her overall length to , and her submerged displacement to approximately 2,600 tons. Her maximum speed was reduced to .