Upvote:2
Based on the translation below, it sounds like Vimalakirti intentionally tried to bring Buddhist teachings to the brothels and cabarets, rather than him being enlightened in spite of frequenting brothels and cabarets.
From the Vimalakirti Nirdesa Sutra, translated by Prof. Robert Thurman:
He made his appearance at the fields of sports and in the casinos, but his aim was always to mature those people who were attached to games and gambling. He visited the fashionable heterodox teachers, yet always kept unswerving loyalty to the Buddha. He understood the mundane and transcendental sciences and esoteric practices, yet always took pleasure in the delights of the Dharma. He mixed in all crowds, yet was respected as foremost of all.
In order to be in harmony with people, he associated with elders, with those of middle age, and with the young, yet always spoke in harmony with the Dharma. He engaged in all sorts of businesses, yet had no interest in profit or possessions. To train living beings, he would appear at crossroads and on street corners, and to protect them he participated in government. To turn people away from the Hinayana and to engage them in the Mahayana, he appeared among listeners and teachers of the Dharma. To develop children, he visited all the schools. To demonstrate the evils of desire, he even entered the brothels. To establish drunkards in correct mindfulness, he entered all the cabarets.
... Thus lived the Licchavi Vimalakirti in the great city of Vaisali, endowed with an infinite knowledge of skill in liberative techniques.