According to Etymology Online, the term pilot has been used since the 1920s to mean "serving as a prototype". It is this sense that you get terms like pilot episode for a TV Show, or pilot program for an emerging technology.

If you go back further in time, there was an old sense of pilot as far back as the 1600s meaning "to guide". For example, in woodworking there is a common technique of drilling smaller "pilot holes", sometimes called "starter holes", in places where you plan to attach two objects by screw; the pilot holes guide the screw in straight and prevent the wood from splitting under the stress.

This earlier sense pre-dated the concept of manned flight by hundreds of years. However, the term pilot is not just used for the captain of an aircraft: the person who steers a ship or boat is also called the pilot, and their job is to "guide" the vessel along the correct path to avoid running aground, etc.

Most likely, the later sense of a pilot episode evolved out of the idea that this episode "guided" the TV show and got it "started" through the initial process of being picked up by the network.