Angels were created to worship God and were created without free will. So how was Lucifer able to turn against God?
Lucifer had a good and perfect purpose before his fall [1]. Lucifer's rebellion does not change God's original intent from something good to something bad [1]. God's sovereignty extends to Satan, even in his fallen condition [1]. God is able to use Satan's evil actions to ultimately bring about God's holy plan [1]. The suffering that Satan brought into the world actually became the means by which Jesus, in His humanity, was made the perfect Savior of mankind [1]. As for the particular sin the bad angels committed, many theologians believe that in their pre-fallen state the angels were given a foreknowledge of humans, as well as a foreknowledge that God himself would be incarnated as a man and redeem the universe through his death on the cross [2]. This revelation angered Lucifer because it meant he and the other angels would have to worship God incarnate [2]. Thus, Lucifer rebelled against God [1].  
You’re right in characterizing Lucifer’s rebellion as an insane act [1, 2]. Although Lucifer had a superabundance of spiritual gifts, he was also endowed, as we are, with the gift of free will [1]. God left him free to choose good over evil, and, as we know, he chose evil [1, 2]. Consider Adam and Eve. Before the Fall they possessed immortality, control over their passions and appetites, the complete integrity of their wills, as well as a human intelligence far superior to that which we have now [1]. Yet, like Lucifer, they chose to commit a mortal sin [1]. This means God allowed them to exercise their free will [1]. As for the particular sin the bad angels committed, many theologians believe that in their pre-fallen state the angels were given a foreknowledge of humans (who would be inferior to them) as well as a foreknowledge that God himself (the second Person of the Trinity) would be incarnated as a man and redeem the universe through his death on the cross [1]. This revelation angered Lucifer because it meant he and the other angels would have to worship God incarnate [1]. Lucifer and the other angels who fell were so proud