Iblīs (alternatively Eblis or Ibris) is a figure frequently occurring in the Quran, commonly in relation to the creation of Adam and the command to prostrate himself before him. After he refused, he was cast out of heaven. For many classical scholars, he was an angel, but is regarded as a jinn in most contemporary scholarship.
He had the choice to sin or not. Some beings are stubborn and arrogant. We see this with humans as well that they know the truth of Allahs punishment yet still persist in sin knowingly.