From the Background: "Names for Navy ships traditionally have been chosen and announced by the Secretary of the Navy, under the direction of the President and in accordance with rules prescribed by Congress. For most of the 19th century, U.S. law included language explicitly assigning the Secretary of the Navy the task of naming new Navy ships. The reference to the Secretary of the Navy disappeared from the U.S. Code in 1925. The code today (10 U.S.C. §8662) is silent on the issue of who has the authority to name new Navy ships, but the Secretary of the Navy arguably retains implicit authority, given the location of Section 8662 in subtitle C of Title 10, which covers the Navy and Marine Corps."
CRS Report for Congress, RS22478
Congressional Research Service: https://crsreports.congress.gov/