I used to believe that after the establishment of the Commonwealth of Poland and Lithuania, the capital was moved to Warsaw to be closer to the center of the combined country. While they're not wrong, the other answers to this effect may overlook a key factor.
Its true that the Sejm or Parliament of the country began meeting in Warsaw as early as 1529, and permanently in beginning in 1569, the year the Commonwealth was established, as per this History of Warsaw.
But the gist of the question was why the capital was moved in 1595 and not in 1569 or some other year. And I found the answer somewhat surprising: Warsaw as a key point in the three way balance of power between Poland, Lithuania, and Sweden.
In 1595, the Polish king was Sigismund III, the son of the King Sweden, and his Queen, Catherine Jagellion, of the Lithuanian royal family. As such, he was a logical choice for "election" to king of Poland. He was also supposed to inherit the Swedish crown, meaning that he would be able to rule both Sweden and Poland in a "personal union."
Unfortunately, Sweden would not allow Sigismund to ascend to the Swedish throne because he was a Catholic. So Sweden "disinherited" him and gave the throne to a cousin. In this context, Warsaw was a much better place for Sigismund to contest the Swedish throne than Krakow (even though he lost); no previous Polish king had attached this kind of importance to Warsaw. One earlier king left the Polish throne to become the king of France; others were more oriented to the southern part of the country.
In the 17th and early 18th century wars against Sweden, Warsaw, which was defended by the Lithuanians, was useful as a "straw" capital that absorbed Swedish power, while Krakow remained a de facto "second" capital when Warsaw was occupied, and formed a focal point for the resurgence of Polish power. This formula didn't work in the 18th century because Austria and Prussian "amputated" Krakow and Gdansk, two important Polish cities in the first partition, leaving her to weak to resist the second and third partitions.