The son of a physician, Nelson was born near Maysville, Kentucky, and attended Norwich Academy. He enlisted in the U.S. Navy as a midshipman on January 28 1840, and achieved the rank of lieutenant by 1855. While in the navy, he commanded a battery at the Siege of Veracruz in 1847, served in the Mediterranean and the South Pacific, and in 1858, as commander of the Niagara, transported to Africa the negroes who had been rescued from the slave ship Echo. At the outbreak of the Civil War, he was placed in command of the gunboats on the Ohio River.
Nelson's family was friends with President Abraham Lincoln. While William's brother Thomas Henry Nelson of Terre Haute, Indiana, was appointed United States minister to Chile, William made several surveys of political sentiment in Kentucky and reported his findings directly to the president. In April, Nelson recruited for the Union in Kentucky and established Camp Dick Robinson in Garrard County, making it a rallying place for loyal Kentuckians. He was detailed for duty in the United States Army on September 16 1861, with the rank of brigadier general. His first assignment was as a brigade commander in the Department of the Cumberland, but by December he commanded a division in the Army of the Ohio under Major General Don Carlos Buell.
Nelson's division first saw combat on the second day of the Battle of Shiloh (April 6 and April 7 1862), when Buell's army arrived in the nick of time to counterattack the Confederates and bring victory to Ulysses S. Grant. He participated in the advance on Corinth under Henry W. Halleck and in Buell's advance upon Chattanooga. He was promoted to major general on July 17 1862, and given command of the Army of Kentucky in August. On August 30 1862, Nelson was soundly defeated by Edmund Kirby Smith's Confederate forces at the Battle of Richmond. He was slightly wounded himself, but lost over 5,300 men (compared to the Confederate loss of 451). He was in command at Louisville, Kentucky, when Confederate General Braxton Bragg threatened that city.
He was killed at the Galt House in Louisville, when he was shot in the chest by his fellow officer, Brigadier General Jefferson C. Davis, who was offended by insults on prior occasions and whose face had just been slapped by Nelson. Nelson died within a few minutes and is buried in his place of birth, Maysville, Kentucky. Davis was arrested but never tried for killing Nelson.