This has been retconned over the years. This is the most current version, that I know of:
This is the NASA insignia:

This is the United Earth Starfleet insignia (in the 2150s, ENT-era):

These are the TNG-DS9-VOY-era Starfleet insignias:

And one further variation from the future:

Originally, this was Starfleet's insignia in the TOS era (no explanation given):

The truth is, the symbol we all know was originally the assignment patch for Kirk's Enterprise. In that era, each ship had their own symbol, and the pennant seen above was Starfleet's. The Enterprise symbol was later adopted for all of Starfleet in recognition of that five-year mission (in-universe). For alternate examples:
This is Admiral James Komack, wearing the Starfleet admiral patch/pin of that time:

This is Commodore Matt Decker, former captain of the USS Constellation, wearing the insignia for his ship:

From left to right, these are the assignment patches for the USS Exeter, the USS Defiant, and finally, the USS Enterprise:

And there's a whole lot more, in every era prior to TNG.