Osama bin Laden grew up in Saudi Arabia. While he was from a privileged family he also was influenced by Wahhabi tradition, which is a Sunni movement that wants to impose Sharia Law. When the Soviets invaded Afghanistan, Osama supported the Mujahideen by providing money to provide materials and transportation for fighters to Afghanistan. At the same time the CIA's Operation Cyclone was providing funds to the Mujahideen.
When the Soviets left Afghanistan, the parts of the Mujahideen morphed into the Taliban, and Osama returned to Saudi Arabia, and al-Qaeda started to develop. Its early focus was other Islamic countries that did not observe Sharia. Libya was one of these countries,and Moammar Kadafi drove them underground.
When the US troops were invited into Saudi Arabia when Saddam Hussein invaded Kuwait, Osama developed a strong anti-US attitude, and turned attention to the west.
The issue here that the US in its attempt to support its interests. The US will support a group which is seeking an end they would like to reach. The philosophy behind the group is not a strong consideration, and only when it starts to cause problems does it become an issue. This needs to be changed.