Alistair MacGregor was born in Victoria, British Columbia and raised in Duncan where he attended Cowichan Secondary School. While working summers as a tree planter, he graduated from University of Victoria in 2003 with Bachelor of Arts, and subsequently from Royal Roads University in 2008 with a Masters of Arts with a focus in professional communication. In 2007 he had moved to Duncan where he began working as the constituency assistant to Member of Parliament Jean Crowder, who had offices in both Duncan and Nanaimo. There he married and fathered twin girls. Upon Crowder's retirement, MacGregor entered the NDP nomination race to select a candidate for the upcoming 2015 federal election in the new Cowichan—Malahat—Langford riding. In the January 2015 nomination election, the 35 year old MacGregor was selected over five other candidates. With the 2015 federal election approaching, the other parties also nominated candidates and the NDP leader Tom Mulcair visited the riding during his tour of Vancouver Island. The Conservative Party nominated North Cowichan councillor John Koury but he withdrew from the race less than two months before the election citing family issues and he was replaced by chiropractor Martin Barker from Duncan. Likewise the Liberal Party originally nominated Langfordsmall business owner Maria Manna but she was replaced by former RCMP officer Luke Krayenhoff of Saanich after Manna withdrew due to a controversy regarding previous comments posted on Facebook. Despite an unexpected surge for the Liberal Party, MacGregor won the riding in line with pre-election polls that projected a NDP victory. While he won his riding, MacGregor's NDP lost seats nationally and fell to third party status, with the Liberal Party forming a majority government. On January 31, 2018, MacGregor was named the NDP's critic for Agriculture and Agri-food, and serves as the vice-chair of the parliamentary standing committee on Agriculture and Agri-food.
42nd Parliament
As the 42nd Canadian Parliament began, NDP leader Mulcair appointed MacGregor to be the party's critic for seniors and its deputy critic for heritage. He was also appointed to sit on the Committee on Justice and Human Rights. MacGregor opened a constituency office in Langford and later one in Duncan. On March 10, 2016, he introduced his first private member bill, , which would have added Shawnigan Lake to the list of navigable waters regulated under the Navigation Protection Act, in response to the previous parliament's Jobs and Growth Act which had removed it. On May 31, 2016, he introduced his another private member bill, , which would amend to the Canada Elections Act to insert a maximum duration of 46 days for an election period. This bill was in response to the 2015 election campaign which lasted 78 days, the longest in Canadian history, and which MaGregor viewed as unfairly favouring the most well-funded political parties. MacGregor held a series of town hall meetings in his riding to hear views on electoral reform and to promote the private member bill. In February 2017 Mulcair reassigned MacGregor to be the party's critic for Justice and in this role he held the party's stance that marihuana possession should be decriminalized during the process of its legalization. After Mulcair's resignation, MacGregor endorsed Jagmeet Singh in the 2017 leadership election. Following Singh's victory, he reassigned MacGregor to be the party's deputy critic for Justice and Heritage. On February 21, 2019, MacGregor introduced bill C-430 that would have amended the Income Tax Act to create an organic farming tax credit.