rap: (noun) a sharp knock or hit; type of music; informal talk, chat; blame, responsibility, consequences, punishment
Used in the expression “to get a bad rap”.
wrap: (noun) wrapping paper; an outer garment; sandwich filling rolled in a tortilla; the end of a filming or recording session
NOT used in the expression “to get a bad rap”.
Both these words can also be used as verbs and adjectives.
If you take the rap, you take the blame or the responsibility for an undesired, possibly illegal, activity. If you beat the rap, that undesired activity still happened, but you didn’t have any consequences from it.
To get a bad rap means to get punishment or consequences that you didn’t deserve. To get a bad wrap probably means that your tortilla was filled with things that were not to your liking.