Just like razors, cowboy hats, and Mickey Mouse, the treble clef has "evolved" over the centuries. It started out as a relatively simple "G". It's fancier form may be due to the fact that, occasionally, vocal pitch was also indicated along with instrumental pitch. The resulting "G sol" was turned to "G.S", and then either mistakenly or carelessly transcribed into the elaborate curlicue shape we know today. Just as with genetic evolution, transcription errors in texts can lead to surprising new forms.
Read the full history of the treble clef's evolution at Smithsonian Magazine.