Son of the Navy

Son of the Navy, also known as The Young Recruit in the United States, is a 1940 American comedy-drama film directed by William Nigh and starring Jean Parker, James Dunn, and Martin Spellman.
Plot.
Racing to his battleship the USS "Florida", Chief Gunners Mate Mike Malone attempts to hitchhike to the Naval Base San Diego and runs into Tommy and his Cairn terrier Terry who are runaways from an orphanage.
The scheming Tommy gets the two a lift to the base. At the base and frightened of being discovered he's a runaway, Tommy meets Steve Moore, the daughter of a Chief Petty Officer and gives her the impression that Mike is his father, especially after Steve saw Tommy see Mike off. Steve spreads the word that Mike is a runaway father abandoning his child getting him in trouble with his ship's captain and fellow chief petty officers.