1) Will Smith
The most recent example of an actor who has played both superhero and supervillain is Will Smith. Though both of his roles were unconventional.
2007’s Hancock was not based on a pre-exiting character but it was still firmly a superhero movie, starring Smith as a sort of alcoholic Superman who gets a PR man to rescue his public image. In 2016, Smith played Floyd Lawton AKA Deadshot, the world’s most wanted hitman who is forced to play hero as part of the Suicide Squad. In effect, both characters fill the same anti-hero role in their respective films. However, by profession, the characters are hero and villain, so Smith gets his place on this list.
You could also count Smith’s role as J in the Men of Black movies. He’s not a superhero, but the films are based off a lesser-known comic book series.