He started his career at Monza. He then spent time in Serie B, Serie C1 and Serie C2 with Padova and Pescara, before joining Brescia along with Vincenzo Mazzeo.
Castellazzi followed Brescia promoted to Serie A in the summer of 2000. He made his Serie A debut on 21 January 2001, against Vicenza. In the 2001–02 season, he was first-choice for the team team, but the next season lost his place to Matteo Sereni. After being loaned to Reggina and Catania in the 2002–03 season, he finally became a regular starter again in the 2004–05 season, in which he played all 38 Serie A games. Castellazzi initially the first choice of 2003–04 season, but lost his place to Federico Agliardi after round 4 and regained his place on round 23.
After Brescia were relegated to Serie B in the summer of 2005, Castellazzi joined Sampdoria on a free transfer, signing a reported two-year contract. He received the number 1 shirt from Luigi Turci. The first season he was the backup of Francesco Antonioli, and Castellazzi only played the three games which Antonioli missed.
In his second season, Castellazzi finally earned a regular place, and in January 2008, he signed a contract extension again which would run until summer 2010.
After the injury during 2009–10 season, he lost his regular place to Marco Storari and in February rumoured he signed a pre-contract with Internazionale.
In total, he played 101 league matches for the Genoese side, while his understudy Antonio Mirante, Gianluca Berti and Carlo Zotti played 22 matches during 2007–08 to 2008–09 season, 11 matches and 1 match in 2006–07 respectively.
On 17 June 2010, Castellazzi joined UEFA Champions League and Serie A champions Internazionale on a free transfer, tying him to the club until 2012. He became one of the understudies to Júlio César along with Paolo Orlandoni and replaced the retired Francesco Toldo. During the 2010–11 season, Castellazzi played in all three major competitions – Serie A, Champions League and Coppa Italia – due to injuries afflicting the first-choice Júlio César.
On 11 May 2012, Castellazzi signed a new contract with Inter, keeping him at the club until 2014.
Castellazzi signed for Torino on a free transfer after completing his contract with Inter in 2014. He debuted for the Granata on 14 January 2015 in the Coppa Italia against Lazio, replacing Cristian Molinaro after the expulsion of Daniele Padelli.
Castellazzi signed a new deal with Torino in 2015, keeping him with the club until June 2016; once expired, he retired from football to become team manager of the club.Internazionale
Supercoppa Italiana (1): 2010
FIFA Club World Cup (1): 2010
Coppa Italia (1): 2010–11