As @Spring Onion said, you're mixing up what Islam says and what terrorists do. Groups like Taliban, Al-Qaeda, Al-Shabaab, etc. are called "khawaarij": terrorists/extremists as defined by Islam. They, and their disgusting ideology, should be confused with what Islam says.