Libya after Qaddafi has been kind of a mess (not that it wasn’t before). The anti-Qaddafi forces, at odds with each other even when fighting on the same side during the civil war, dissolved into bunches of militias, few of which answered to the central government. Because Qaddafi essentially obliterated the institutions necessary to have a functional government, the Libyan government has been unable to corral the militias that arose after his fall. Today, two major armed factions are competing for control over Libya, and the fighting has created an environment where jihadist groups have prospered.
After the war ended in August 2011, Benghazi became an epicenter of militia activity. Because it was the most important base of rebel strength, a lot of rebels who later joined militias hailed from Benghazi and the surrounding environs in the region of Cyrenaica. Some of those groups even attempted to turn Cyrenaica into a functionally independent state, with Benghazi as its capital. Today, the situation is ironically reversed: the faction aligned with the internationally-recognized government controls the eastern half of the country, while a separate group, Libya Dawn, controls much of the west.
With a number of different Libyan factions busy fighting each other after Qaddafi’s fall, no one was really interested or able to root out the jihadi groups that moved in after Qaddafi — some of which had participated in the rebellion, some of which had only shown up after. These violent, anti-American groups thrive in chaos, and swiftly grew in strength in Libya after Qaddafi’s demise.