The pilot episode is made on its own as a test for whether a show might work. Then the executives at the network decide if they're going to "pick up" the show. Often, the pilot serves as the first episode, but not always. Sometimes the pilot has to be thrown out - usually due to casting issues, sometimes locations.