The Hollywood Reporter has an informative oral history of The West Wing:
Aaron Sorkin: I didn’t really know anything about television beyond watching a lot of it, and my plan was to come up with an idea for a new play or movie, but my agent wanted me to meet with John Wells, and I said, “Sure.” The night before the meeting, there were some friends over at my house, and at some point [Akiva Goldsman and I] slipped downstairs to sneak a cigarette. Kivi knew about the meeting and said, “Hey, you know what would make a good series? That.” He was pointing at the poster for The American President. “But this time you’d focus on the staffers.” I told him I wasn’t going to be doing a series and that I was meeting with John to meet John — I wanted to hear stories about China Beach and ER, and I especially wanted to hear about his years as stage manager for A Chorus Line. The next day I showed up for the lunch, and John was flanked by executives from Warner Bros. and agents from CAA. John got down to business and said, “What do you want to do?” And instead of saying, “I’m sorry, there’s been a misunderstanding. I don’t have anything to pitch,” I said, “I’d like to do a series about staffers at the White House.” And John said, “We’ve got a deal.”