Colossians said:
In macro-evolutionary terms, explain how the desire to do what is not allowed, evolved.
I'll actually take a serious crack at this. "What is not allowed" is highly vague, but I will assume the OP is referring to some behaviour, such as adultery, frowned upon by a social collective.
Men have to compete for women (and vice versa) for the biological holy grail of leaving offspring. Like businesses competing for customers, men have an instinct to hoard women, that is, toward polygamy. While at some level it might sound appealing for a man to have a harem waiting for him at home each night, socially that is not a stable situation. For every man with 4 wives there will be 3 men with none. The males will start to fight for access to the females. Not good. Likewise, if one business started hoarding customers, there would be many competitors with few or none.
So, society invented monogamy to spread the female "wealth" around a bit. That is to say, men agreed not to compete so hard for females in exchange for some social stability. In economics, cartels such as OPEC agree not to compete with members of the cartel so as to raise prices and profits and to promote their economic stability. Viewed in economic terms, the institution of marriage is analogous to a cartel.
But just like a cartel, there is an incentive to cheat. Biologically, it is a good reproductive strategy for men to mate with as many women as possible. But society (and the partner) impose a cost on cheaters. Men with a wandering eye weigh the potential benefits of adultery (such as sexual variety or additional offspring) with the potential costs (such as the loss of the primary mate and alimony). Society may impose additional costs such as making adultery a crime or having religion invoke the displeasure of a deity. Likewise, cartels impose penalties on members who secretly lower their price or increase their output. What is interesting is that many people -- perhaps most -- who have taken a vow of monogamy with their mate will break that vow at some point despite the costs.
So, in terms of evolution, there is a strong incentive for men to do "what is not allowed" in this example. But society has placed restraints on this behavior.