William Anderson, the son of Francis Anderson, a blacksmith, and Barbara (née Cruikshank), was born in Findon, Banffshire, Scotland, on 13th February 1877. His biographer, Joseph Melling has claimed: "His mother was an intelligent and widely read woman of strong, radical, Presbyterian views who encouraged William to read extensively and passed on a love of literature which stayed with him long after he was converted to free-thinking atheism."
Educated at elementary school he was apprenticed to a manufacturing chemist. He joined the Shop Assistants' Union and in 1903 became one of its organizers. During this period he fell in love with Mary Macarthur, the secretary of the Ayr branch. Both were committed socialists and joined the Independent Labour Party. During this period he worked closely with other socialists in Glasgow including David Kirkwood, John Wheatley, Emanuel Shinwell, James Maxton, William Gallacher, John Muir, Tom Johnston, Jimmie Stewart, Neil Maclean, George Hardie, George Buchanan and James Welsh.
In 1907 Anderson moved to London. The following year he was elected to the national administration council of the Independent Labour Party in 1908, and served as its chairman (1911-14). Anderson earned his living as a journalist and in 1912 he joined forces with Ramsay MacDonald to launch The Daily Citizen.
Anderson married Mary Macarthur on 21st September 1911. Their first child died at birth in 1913 but two years later a daughter, Anne Elizabeth, was born. Anderson was elected to the House of Commons to represent Sheffied Attercliffe in 1914. The historian, Joseph Melling, has argued: "A handsome, charming, and engaging personality, Anderson was able to attract support from different sections of the Labour Party and to avoid bitter factional disputes. He was an effective and persuasive debater, whose warmth of manner gave him an advantage over Ramsay MacDonald."
On the outbreak of the First World War, Anderson and Macarthur opposed military conflict. Anderson also supported the Clyde Workers' Committee and organisation that had been formed to campaign against the Munitions Act, which forbade engineers from leaving the works where they were employed. David Lloyd George and Arthur Henderson met the Clyde Workers' Committee in Glasgow on 25th December 1915 but they were unwilling to back down on the issue.
On 25th March 1916, David Kirkwood and other members of the Clyde Workers' Committee were arrested by the authorities under the Defence of the Realm Act. Then men were court-martialled and sentenced to be deported from Glasgow. Anderson severely criticised this decision in the House of Commons.