Nuns with bad habits not usually that kind. Nuns are women who have dedicated their lives to religious service, forgoing sex nude material wealth. In the land of fiction, they complete the Fetish Trio right up there with Nurses and Maids. There is just something about nuns that turns a nun of guys on.
Maybe it's the mystery of it families swimming nude. After all, they wear the elaborate robes and live in secret, away from men. Maybe it's the Forbidden Fruit factor: If a nun is fetishized, expect her habit to be far shorter and tighter than anything you would see in a real convent.
Additionally, most Nuns Are Mikos in anime. Church Militant nuns, by nature naughty not only being a nun but an Action Girlhave a tendency of following this trope as well.