I'm not a girl, but I think one explanation is something that isn't really gender specific and can be applied to both men and women. Humans crave change, excitement and challenge. I'm sure you've heard the popular quote, "you always want what you can't have". When something becomes too routine, easy and boring, it becomes less appealing.
Humans are also said to be able to adapt to their circumstances quite fast - any situation and in some cases adapting as fast as two weeks, I've heard. A really extreme example could be something as awesome as winning a million dollars. You'd initially be overcome with joy, but it's entirely possible that after two weeks, you'd start to take the money for granted (that is if you haven't spent it all already!) and feel exactly how you did just before you won the money.
One of the characteristics of a "bad boy" is unpredictability; you never know what he's gonna do. A "good girl" might be initially attracted to this because he provides constant excitement and danger in an otherwise normal everyday life - or constant excitement and danger as compared to the "good boy" who will always take care of you, but is boring because you already know that he'll always take care of you.
This is a popular explanation also, but girls are said to like the challenge of being able to tame the bad boy - convert him from his wild ways to become a suitable husband. I guess the theory is that, although you initially crave the excitement, just like anyone craves passion in a relationship, eventually that passion matures into companionship. You eventually want someone that will spend a rainy sunday afternoon at home with you trying to solve crossword puzzles and someone who will eventually be a good father to your children, instead of someone who will wake up sunday morning and decide to skip a week of work so he can spend it with you in Las Vegas instead!