Why was 4th Hokage chosen when the 3rd was still alive and capable?
In the wiki stands the following:


  After serving as Hokage for many years, Hiruzen started looking for a successor to the title. While he hoped to be able to give the position to Orochimaru, he saw that he only was interested for the power it offered. Though he turned to Jiraiya, Hiruzen instead named Jiraiya's student Minato Namikaze as his successor.


I found no information about why he wanted to retire, but it seems that he just wanted to retire. Additionally shortly before he died, he spoke about retirement too. 

Note that the Second Hokage chose the third before he died according to this article:


  He chose to sacrifice himself after he selected his prized student Hiruzen for the position of Third Hokage. Homura and Koharu would later become Hiruzen's advisers. After giving the title of Hokage to Hiruzen, Tobirama went off to fight the enemies where he died a noble death