The good guys and the bad guys
There is a myriad of biological, psychological and sociological theories that attempt to explain deviant behavior and many of them get it at least partly right. I think Freud's concept of the Pleasure Principle comes closest. Some of Freud's more esoteric psychoanalytical theories bend the mind of the common man but his theory of the Pleasure Principle is pretty straightforward.
Freud developed this theory by watching children at play and he was struck almost immediately by a common bond all children had. They were happiest when they were having fun and they had the most fun when they were allowed to do what they wanted to do. He defined this drive as the Id and called it the pleasure seeking side of the self.
For example, let's say a mom takes her toddler outside to play while she's working in the garden and her work is interrupted by shrieks of joy and laughter from the child. When she turns around to see what he's doing, she discovers in horror that he's found the only mud puddle in the yard, has climbed into the middle of it, and is covered with mud. He's throwing it, rubbing it all over himself, eating a bit of it and having the time of his life. When she runs over to him and yanks him out of the mud puddle, what does he do? His shrieks of joy turn into wails of sadness and displeasure because, of all the things he could have chosen to do outside that day, playing in the mud puddle was the most attractive option for him. And when mom interrupted his good time, his shrieks of joy and laughter turned into a crying, screaming fit because he was no longer being allowed to do what he wanted to do.
If you think about it, we're all that way. We all gravitate toward those things that give us pleasure and attempt to avoid those things that don't. One reason why so many marriages fail is that the interest levels of the husband and wife aren't the same and sometimes even conflict. If your major source of enjoyment is sports and your wife's is the opera, you may compromise and go with her to the opera as long as she will go with you to a sporting event but all of us know you won't be very happy at the opera and she won't be very happy at the ballgame. If there are too many of these disconnects, the marriage runs into trouble.
Freud says that parents allow their small children to indulge their fantasies for awhile but quickly start teaching them the rules and expectations of society because we can't always just do what we want to do. There are rules and laws that impede our good times significantly and to be good, law abiding citizens, we have to learn those rules and laws and abide by them. Freud calls this internalization of society's expectations the Superego and he contends that once we're exposed to these rules and expectations, a battle begins within each of us between the pleasure seeking drives of the id and the perfections seeking demands of the superego.
That's why the greatest degree of criminality, deviance, and delinquency is found in our young. Statistics prove clearly that if you haven't gotten into trouble with the law by the time you're in your early 20s, you probably never will. That's because the rules and the laws become so entrenched in our psyche that violating them simply is no longer an option. The superego has pushed the id so far underground that, for many people, it essentially disappears.
On the other hand, another perspective called labeling theory doesn't ask why we deviate or why we go by the rules because this theory says that we ALL deviate. Some commit more deviance than others and some commit more serious deviance than others but there are no perfect people in the world. So this theory says the difference between the good guys and the bad guys is one of perception rather than reality.
According to labeling theory, the bad guys got caught and the good guys didn't. We give each other the benefit of the doubt and don't assume that a person is deviant until they're caught and labeled as being deviant. So if you successfully hide your deviance, even though it may be regular and habitual, you'll continue to be treated as a good guy. We've seen this theory manifest itself publicly over and over by the malfeasance of church officials, business leaders and politicians over the years.
Their deviance escaped detection for long periods of time and, consequently, they continued to do their jobs with the support of the people they served because the people didn't know. Once their deviance became public and known, the gig was up.
I've always believed we have far too many laws restricting far too many behaviors. The law is legitimate when it attempts to protect us from others who would do something to us or our property or possessions against our will.
But that initial law has expanded to try to protect us from ourselves and I think that's where it overreaches. In fact, I believe that anything one or more adults want to do voluntarily with each other should be allowed, regardless of what it is, as long as everyone is participating voluntarily and no one is harmed against their will.
I'm pretty sure that's a minority view but it makes sense to me.