Andrew Miller has been a good pitcher for the Yankees, but at his age, he's only going to decline. The Yankees are also probably not going to make the playoffs this year, so this is a good time for them to rebuild and trade aging players for prospects who could develop into good players. The Yankees will probably be better in the long run because of this trade.
They will be able to recruit young new players that have better skills and more promise than Andrew Miller becasue of the trade they need. He was dragging them down and was not the best fit for thier team. The money that they save from the team will help them recruit better.
By trading Andrew Miller, the Yankees are working on their future. Miller is a high-cost player, and the trade now opens the Yankees to more promising recruits that will help to shape their future. After trading Miller, the Yankees are now acquiring promising players such as Clint Frasier and Gleyber Torres, who are considered top prospects by Baseball America. The Yankees have not won a playoff game since 2012, and need to fill out their roster with players that can help bring the team back to a championship.
I hate the Yankees (let's go Mets!) but good lord, they are poised to dominate by 2018/2019. They have a stacked farm system, they're still over .500 despite being a team full of senior citizens, and the free agent class of 2019 in particular means that can be like the old Yankees and by three to four World Series wins throughout the 2020s.