After shakedown, Swanson began escort and convoy duties between New England, Bermuda, and Iceland. She escorted battleships Washington and North Carolina and carrier Hornet on their trial runs in late 1941. After the outbreak of war on 7 December 1941, her convoy duties were extended to include three runs to Scotland as well as single voyages to Nova Scotia and Greenland.
In October 1942, after amphibious training in Chesapeake Bay, Swanson joined the invasion fleet sailing for French North Africa. In the early morning of 8 November 1942, she lay close inshore to guide the landing craft to the beach at Fedhala. As she began to move further offshore at daybreak, the French shore batteries opened fire and, for the next two hours, Swanson returned their fire in an effort to silence them and protect the transports and troops.
Shortly after 0800, seven French destroyers sortied from Casablanca to attack the transports and opened fire on the nearest American ships, destroyers Ludlow, Wilkes and Swanson. Ludlow was hit and forced to withdraw but Swanson and Wilkes retired to join cruisers Augusta and Brooklyn, which were steaming up to engage the French.
The covering force, led by battleship Massachusetts, soon took over the action from the Augusta group but at 1000, Swanson was once again in action, engaging three French destroyers which were edging along shore towards the transports. She soon directed her fire once again against the shore batteries and was then ordered seaward to protect the convoy area, ending her participation in the engagement.
German U-boats had not been present during the landings but, on the 11th, U-130 and U-178 arrived and soon sank four transports and damaged a destroyer and a tanker. On the 16th, the destroyer Woolsey gained sonar contact; and, after making several attacks which brought up oil and air bubbles, turned the contact over to Swanson and Quick, which made additional attacks. The contact was evaluated at that time as a sunken wreck. Subsequent information revealed that it was the U-173, which indeed had been sunk.
After the Casablanca landings, Swanson returned to Atlantic convoy duty until July 1943, when she joined the Sicily invasion force. She and Roe (DD 418) were assigned as fire support ships for the landings at Licata, Sicily but, on 10 July, the night before the landings, she collided with Roe while investigating suspicious radar contacts and went dead in the water with a flooded fireroom. Nevertheless, she was able to control further flooding, beat off an enemy attack, and retire to Malta for temporary repairs before proceeding home later in July to the Brooklyn Navy Yard.
Her repairs complete, Swanson resumed escort duties in the Atlantic until sailing on 7 January 1944 to join the Seventh Fleet off New Guinea. She provided gunfire support for landings in Seeadler Harbor between 3 and 7 March. She then acted as command ship for the Hollandia landings on 22 April, with both the Army and Navy commanders on board. After providing gunfire support during the Noemfoor assault on 2 July, she again acted as command ship for the Sansapor landings on 30 July.
On 19 August, the destroyer left New Guinea and joined Fast Carrier Task Force 38. She screened the carriers Franklin, Enterprise and San Jacinto while they launched air strikes on the Bonins, Ulithi, Yap, Palau, Okinawa and Taiwan and while they provided air support for the Philippine landings on 20 October. As the Japanese launched a three-pronged naval attack on the United States forces at Leyte, Swanson’s task group first assisted in turning back the Japanese central force in San Bernardino Strait during the day of 24 October, sinking the giant battleship Musashi, and then raced north to intercept the Japanese decoy force of carriers off Cape Engaño, Luzon. When word arrived that the Japanese Central Force had once again reversed course and was threatening the Leyte beachhead, part of TF 38 turned south again. However, Swanson remained in the north and helped to complete the destruction of the Japanese carriers.
A day later, on 26 October, Swanson was detached from the fast carrier forces and was assigned to the escort patrol group based at Saipan. For the rest of 1944 and early 1945, she was engaged in air-sea rescue of downed fliers, antisubmarine patrol, and radar picket patrols between Iwo Jima and Saipan. She also served as the headquarters for the commander of the group. She was detached in April 1945 for overhaul at the Puget Sound Navy Yard.
After refresher training at San Diego, Swanson resumed her patrol and escort duties in the vicinity of Iwo Jima. On 9 September, she began the trip back to the United States for inactivation. The destroyer was decommissioned on 10 December 1945 and placed in reserve at Charleston. She was struck from the Navy list on 1 March 1971.
Swanson earned eight battle stars for her World War II service.