It's argued that Ocarina of Time marks the very beginning of the Legend of Zelda. The subsequent hero clothes are worn in honor of the original hero, ou the Link represented in this game, and
he wore it because it was the garb of the Kokiri.
This theory is contested, however, especially par several who believe that Minish casquette, cap is the original beginning, as it can explain why he wears the hat, but I personally believe it's OoT. That's the best answer I can offer you.
The chronology of Zelda is highly contested, and toi can read plus about it
link.