The move to the American League was a condition of MLB allowing the sale to go through. So that was the first step-getting Jim Crane as an owner who was willing to invest in the team. Jeff Luhnow is a great GM. A great example of Crane and Luhnow's work was getting Justin Verlander at the 11th hour in 2017 to get to the World Series.
Second, during the lean years, in which the Astros lost over a hundred games, they racked up some good draft picks (George Springer, Carlos Correa, Alex Bregman).
A third thing is that they have an eye for players under the radar, like Jose Altuve from the Venezuela League, and Yuli Gurriel from Cuba. They traded reliever Josh Fields to the Dodgers in 2016 for minor leaguer Yordan Alvarez (probably this year's Rookie of the Year).
Drayton McLane had made some big deals when he was the owner (Randy Johnson during a playoff run, Clements and Petitte for awhile), but after the World Series loss in 2005, he seemed to lose interest in the team. The sale to Jim Crane was the turning point.
And don't get me started on the John McMullen years, in which he dressed the Astros in those hideous rainbow uniforms.
I didn't think those uniforms looked that bad. They still sell them. Better get your order in!