Shahzad was born in a family of Pakistani background; his father migrated from Gujar Khan, Punjab. His father was an accountant by profession who himself represented Idle and played in Pakistan's Quaid-i-Azam Trophy. Shahzad grew up in Bradford and attended Bradford Grammar School and later Woodhouse Grove School; he lived close to the house of fellow cricketer Adil Rashid. He studied four months of pharmacy at Bradford University before eventually transferring to Leeds Metropolitan University to study sports science to enhance his career in cricket.
In 2004, he became the first Yorkshire-born player of Asian extraction to play for Yorkshire.
In his only first-class appearance in 2006, he failed to take a wicket, and scored just two runs. He enjoyed more success in the shorter formats of the game, claiming five wickets and 18 runs in four List A matches for his native county, and in his sole Twenty20 appearance, he took 2 wickets.
In 2009, Shahzad enjoyed an injury free and successful season, taking 40 wickets and scoring 445 runs in the late middle order, raising hopes that he may yet exhibit genuine all-rounder potential. His performances gained him a call up to the England performance squad in South Africa squad, where he impressed coach Andy Flower.
In January 2010, he was named in the Test and ODI squads for the England tour of Bangladesh. On his debut for England in a Twenty20 International against Pakistan, he claimed two wickets, both in his first over.
He later made his ODI début against Bangladesh, again taking a wicket in his first over. When Bangladesh later toured England, he made his Test début in the second Test, replacing the injured Tim Bresnan. After only scoring 5 runs in England's innings and an expensive start with the ball, he later took 3 wickets in 3 overs in his second spell as Bangladesh missed the follow-on target. Pakistan toured England in July and Shahzad was included in England's 12-man squad for the first Test. A week in advance of the Test, he twisted his ankle in a match for Yorkshire. As he was still experiencing discomfort the day before the Test, England chose to drop him from the squad as a precaution and bring in Tim Bresnan.
Though pundits had expected Shahzad to be included in England's squad for the 2010–11 Ashes, he was omitted from the 16-man touring party. However, he was included in the performance squad who were training in Australia and ready to provide cover in the event of injuries. He was not called upon in the Tests, but played two T20Is against Australia and the first five games of the seven ODIs that followed. He took 6 wickets at an average of 40.50 before a hamstring injury in the fifth match ruled him out of the rest of the series. Shahzad was included in England's 15-man squad for the 2011 ICC World Cup held in Bangladesh, India, and Sri Lanka in March 2011. He managed three wickets from two appearances in the tournament, however a recurrence of the hamstring injury sustained against Australia meant Shahzad was forced to bow out of the tournament prematurely.
On his return for Yorkshire, he struggled for form and was left out of the England Test and ODI squads to face Sri Lanka. In the County Championship he managed 25 wickets at an average of 41.00. In September, Shahzad was reprimanded for scuffing the pitch during the penultimate Championship match against Warwickshire and fined £750. The club was relegated from the First Division in the final match of the season. Shahzad regretted the incident, explaining "It's not the way I want to play my game. I don't want to be seen as a cheat, or a pitch-damager. ... It's one mistake I've made in an eight- or nine-year career so far. It's out of the blue for me, and I definitely would never do anything like it again. It was just a random, stupid act." Despite a trying year, Shahzad was selected in the England Performance Programme held over the English off-season.
In April 2012 Yorkshire's new bowling coach, Jason Gillespie, praised Shahzad's efforts, saying "Ajmal has got himself in as good a condition as he's ever been in his first-class career. He's worked incredibly hard, and I think he's a fantastic bowler, a very exciting bowler." However, on 1 May 2012, it was announced that Shahzad was to leave Yorkshire and a week later he joined Lancashire on loan for the rest of the season with a view to agreeing a permanent contract at a later date.
On 10 October 2012, having been told he was free to leave Yorkshire, Shahzad signed a three-year contract to join Nottinghamshire.
On 7 November 2014, he was released a year early from his Nottinghamshire contract and signed a three-year contract with Sussex.
On 10 July 2017, Shahzad departed Sussex after his contract was terminated by mutual agreement.