William P. Anderson was born on September 10, 1840, in Ohio to Larz and Catherine Anderson. His father was a lawyer who owned $50,000 of real estate and $12,000 of personal property by 1860. He grew up and attended school in Cincinnati, Ohio, and he graduated from the Renssalaer Polytechnic Institute in 1860. He returned to Cincinnati after college and earned a living as a civil engineer.
Anderson enlisted in the Union army on April 20, 1861, and he mustered in as a corporal in Company A of the 6th Ohio Infantry later that day. The regiment took part in the Battle of Shiloh, the Battle of Perryville, the Battle of Stones River, the Battle of Chickamauga, and the Atlanta campaign. He was promoted to sergeant on June 18, 1861, to 2nd lieutenant on August 3, 1861, and to captain on November 28, 1862. He also served as an assistant adjutant general. He resigned on March 18, 1864, and he later received a brevet promotion to major.
He returned to Cincinnati after the war and worked on an oil refinery. He married a woman named Julia, and they had at least seven children: Rachel, born around 1864; Larz, born around 1867; Catherine, born around 1870; William, born around 1875; Laura, born around 1876; Ida, born around 1877; and Frank, born around 1879. He served as a director of the Chesapeake and Ohio Railroad and the American Cotton Seed Oil Company. He died of heart failure in Cincinnati on November 20, 1897.