Castellanos, 30, is coming off his best big league season for Cincinnati, a campaign in which he ranked in the top 10 of the National League in several offensive categories. He finished fourth in NL batting average (.309), hit 34 homers (tied for seventh), drove in 100 runs (tied for ninth), ranked third in slugging (.576) and fourth in OPS .939. He posted a career-best 3.2 WAR, according to baseball-reference.com.
It was a banner season all around for Castellanos. He was elected as a starter for the NL in the All-Star Game, won a Silver Slugger award and finished 12 in balloting for NL MVP.
On Nov. 4, Castellanos opted out of the final two years of his contract with the Reds that would have paid him $34 million. Cincinnati then extended Castellanos the qualifying offer of $18.4 million, which he rejected, making him a free agent. As a result, the Reds will get a compensatory 2022 draft pick that will fall after the first round.
The deal comes only four days after reigning NL MVP Bryce Harper said it would be a "downer" if the Phillies didn't sign Castellanos or one of two other prominent free-agent sluggers.
"Nicky, I really enjoy him as a player, a good left fielder." Harper said Monday. "He'd be a great middle-of-the-order bat for us."
The team finished 82-80 last season, its first winning record since 2011, but the Phillies extended their postseason drought to an NL-worst 10 years.
Philadelphia needed a left fielder, and president Dave Dombrowski on Sunday said that ownership hadn't given him any limitations on spending money.
Dombrowski was president and general manager of the Tigers when they drafted Castellanos in 2010 and he debuted with Detroit in 2013 as the team's regular third baseman.
Castellanos has primarily played right field since late in the 2017 season after switching away from the hot corner. Since the beginning of the 2016 season, he ranks 14th among all big league batters in hits (860) and is second in doubles (214).
As strong as Castellanos has been at the plate as a big leaguer, he's often struggled as a defender. According to Fangraphs, Castellanos has posted minus-93 defensive runs saved during his time in the majors. That's the worst figure among all fielders since Castellanos broke into the majors in 2013.
In addition to the Reds and Tigers, Castellanos has also previously played for the Chicago Cubs. He was drafted with the 44th pick of the 2010 draft, in a compensation round, out of Archbishop McCarthy High School in Southwest Ranches, Florida, about 30 miles from downtown Miami.
Since the Major League Baseball lockout ended, the Phillies have signed free-agent relievers Brad Hand and Jeurys Familia, each to a one-year deal for $6 million. They also brought back outfielder Odubel Herrera on a one-year contract.
Before the lockout, the Phillies signed Corey Knebel to be their closer.
ESPN's Bradford Doolittle and the Associated Press contributed to this report.