We cannot understand the why of ISIS, but we know the how. How was it able to dispatch the Iraqi army and take over much of Iraq and Syria?
By disbanding the Iraqi army, the U.S. released thousands of armed, trained, skilled and motivated military personnel onto the streets. The majority were Sunnis. Sunnis had oppressed the majority Shiite population under Saddam Hussein and anticipated, correctly, a reversal of roles. The dissolution of the Iraqi army delivered a ready-made military force to the insurgency, killing thousands and eventually forming the core of the ISIS military machine.
Making a bad situation worse, the U.S. stood by while the Iraqi army was stripped of any competent Sunni officers, replacing them with compliant and corrupt Shiite militia. No wonder the Iraqi army collapsed upon its first encounter with ISIS.
Now there is a European refugee problem and ISIS, and by extension, the U.S., are much of the cause.