Swanson was laid down on 15 November 1939 by the Charleston Navy Yard. She was launched on 2 November 1940; sponsored by Mrs. Claude A. Swanson, widow of Secretary Swanson; and commissioned on 29 May 1941 with Lieutenant Commander M. P. Kingsley in command.

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 08:00, seven French destroyers sortied from Casablanca to attack the transports and opened fire on the nearest American ships, destroyers Ludlow (DD-438), Wilkes (DD-441) and Swanson. Ludlow was hit and forced to withdraw; but Swanson and Wilkes retired to join cruisersAugusta (CA-31) and Brooklyn (CL-40), which were steaming up to engage the French.

The covering force, led by battleship Massachusetts (BB-59), soon took over the action from the Augusta group; but, at 10:00, 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 11 November 1942, U-130 and U-173 arrived and soon sank four transports and damaged a destroyer and a tanker. On 16 November, the destroyer Woolsey (DD-437) gained sonar contact; and, after making several attacks which brought up oil and air bubbles, turned the contact over to Swanson and Quick (DD-490), 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 fire room; 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 7th 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 1944, the destroyer left New Guinea and joined Fast Carrier Task Force (TF 38). She screened the carriers Franklin (CV-13), Enterprise (CV-6), and San Jacinto (CVL-30), while they launched air strikes on the Bonins, Ulithi, Yap, Palau, Okinawa, 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, California, Swanson resumed her patrol and escort duties in the vicinity of Iwo Jima.

On 9 September, USS Swanson began the trip back to the United States for inactivation. The destroyer was decommissioned on 10 December 1945 and placed in reserve at Charleston, South Carolina. She was struck from the Navy list on 1 March 1971 and scrapped in 1972.