Ainsworth was born in Coventry on 19 June 1952, and attended the local Foxford Comprehensive School. He first became active in politics as a trade unionist at the Jaguar Cars plant in Coventry where he worked and served in many union capacities, including as Branch President (in what was later to become part of the Manufacturing, Science and Finance union). In 1984, he was elected to Coventry City Council, became Chair of the Finance Committee, and was deputy leader of the ruling Labour group. He was also Constituency Labour Party chairman.
Ainsworth tried to become Labour candidate for Coventry North East in the run-up to the 1987 general election, after George Park MP announced his retirement, but only came third at the selection meeting, behind John Hughes and Ted Knight. In the run-up to the 1992 general election Hughes was de-selected by the Constituency Labour Party, and Ainsworth became the candidate. He was elected with an 11,676 majority, and stepped down from the city council the following year. At the 1997 general election his majority rose sharply to 22,569, falling back to 15,751 at the 2001 election, and 14,222 at the 2005 election.
On 7 December 2012 Ainsworth announced his intention not to stand at the United Kingdom general election, 2015.
Ainsworth was appointed a Labour whip in 1995 and served in government until January 2001 when he was promoted to Parliamentary Under Secretary of State at the former Department for Environment, Transport and the Regions. After the 2001 general election, Ainsworth was moved to the Home Office as Parliamentary Under-Secretary with responsibility for Drugs and Organised Crime, where he remained until 2003, when he became the Deputy Chief Whip (also known as the Treasurer of the Household). He was appointed to the Privy Council in February 2005. On 29 June 2007, he moved to become the Minister of State for the Armed Forces.
On 5 June 2009, he was appointed to the cabinet by Gordon Brown as Secretary of State for Defence, in what was considered by some to be "a surprise choice". As Defence Secretary, Ainsworth declared in July 2009 that "the government should have offered more support to British troops at the beginning of the wars in Afghanistan and Iraq."
At the Labour Party Conference in Brighton in 2009, Ainsworth stated that sending reinforcements to Afghanistan may not be possible because of a lack of necessary military resources. He said, "Before I agree to any increase in troop numbers I must be sure that the balance of risk is acceptable by evaluating the capacity of the supply chain to properly equip the increased force."
In the 2009 Parliamentary expenses scandal, in which a number of MPs were criticised for their expense claims, it was revealed that, in 2007–08, Ainsworth had claimed the maximum permissible amount of £23,083 for second-home allowances, making him the joint highest claimant that year with 142 other MPs. For 2008–09, he claimed £20,304, 269th out of 647 MPs.
Ainsworth launched the Home Office's "Safer Clubbing" guide in 2002 which provided guidance to nightclub owners on harm reduction relating to recreational drug use.
In December 2010, Ainsworth called for the legalisation and regulation of drugs, arguing it is better for addicts to receive their fixes on prescription rather than relying for their supply on the international criminal gangs that make billions of pounds from the trade. As a Home Office minister, Ainsworth was responsible for drugs policy.