He was probably inspired in part by Jack Sheppard who, like Macheath, escaped from prison and enjoyed the affections of a prostitute, and despised violence. His nemesis is Peachum who, in John Gay's original work, keeps an account book of unproductive thieves (something that Macheath himself does in Bertolt Brecht's work). Both characters can be understood as satires of Robert Walpole and Jonathan Wild.
In popular culture
In The Threepenny Opera
In Bertolt Brecht's The Threepenny Opera, he is referred to as "Mack the Knife", and is the subject of the song of the same name. Whilst his character plays roughly the same role as in the work it is derived from, Macheath is a much less romantic character here, described as a cutthroat, rapist and seducer of underage girls.