Author Veronica Roth answers this question on her blog:
What inspired you to write Divergent?
Without a doubt, this is the most frequently asked question of all
the frequently asked questions, and that does not surprise me at all. I
always want to know where my favorite authors get their ideas. And it
seems pretty simple, because there was a precise moment when the writer
started the story, and so it seems like there had to be a precise moment
when they came up with the idea for it.
The thing is, for a lot of writers, it’s more complicated than that.
For those of us who didn’t have a vivid dream, or ask ourselves a “what
if” question, or any of the other concrete ways that ideas come to
people, it’s actually difficult to answer. That’s why I give a different
answer in every single interview I ever do– because at the moment that I
am asked the question, I think of another, equally important, source of
inspiration.
So in order to answer it, I’m going to give you the overly detailed
explanation. But I’ll say, first, that Divergent really happened when a
bunch of these pieces of inspiration suddenly coalesced in my mind as I was writing,
and I got about thirty pages of a story from Four’s perspective down,
and then set it aside because it wasn’t so good. It was only when I
discovered Beatrice that I was able to write the full book, four years
later.