JFK was assassinated because he was restructuring the CIA so it could no longer be used by the ruling powers ("the international capitalist cabal") to carry out foreign and domestic terrorism.
JFK had already fired Allan Dulles as head of the CIA.
"Only three days after the disastrous Cuban defeat, Kennedy set up a Cuban Study Group headed by Gen. Maxwell Taylor to ‘direct special attention to the lessons which can be learned from recent events in Cuba.’
“With that action, which received little notice at the time, the President declared war on the agency. The Cuban Study Group was one of the most important creations of the Kennedy presidency, and it was the source of one of the major pressure points on the way to the guns of Dallas on November 22, 1963.
"Kennedy’s good friend Supreme Court justice William O. Douglas, in recalling a discussion he had with Kennedy shortly after the disaster, said:
"This episode seared him. He had experienced the extreme power that these groups had, these various insidious influences of the CIA and the Pentagon, on civilian policy, and I think it raised in his own mind the specter: Can Jack Kennedy, President of the United States, ever be strong enough to really rule these two powerful agencies? I think it had a profound effect . . . it shook him up!”L. Fletcher Prouty. (1992). JFK: The CIA, Vietnam, and the Plot to Assassinate John F. Kennedy
Though he was responsible for creating it, President Harry S. Truman had begun to see the insidious power of the CIA. In a column that appeared in the Washington Post on December 21, 1963, he expressed his grave doubts about this sinister agency:
“For some time I have been disturbed by the way the CIA has been diverted from its original assignment. It has become an operational and at times a policy-making arm of the government...
“I never had any thought that when I set up the CIA that it would be injected into peacetime cloak-and- dagger operations. Some of the complications and embarrassment that I think we have experienced are in part attributable to the fact that this quiet intelligence arm of the President has been so removed from its intended role that it is being interpreted as a symbol of sinister and mysterious foreign intrigue and a subject for Cold War enemy propaganda.”
What the rest of the world feels about the CIA can best be understood from "the words of Arnold Toynbee, the eminent British historian and friend of the United States, as quoted in the New York Times of May 7, 1971: "To most Europeans, I guess, America now looks like the most dangerous country in the world. Since America is unquestionably the most powerful country, the transformation of America's image within the last thirty years is very frightening for Europeans. It is probably still more frightening for the great majority of the human race who are neither Europeans nor North Americans, but are Latin Americans, Asians, and Africans. They, I imagine, feel even more insecure than we feel. They feel that, at any moment, America may intervene in their internal affairs, with the same appalling consequences as have followed from the American intervention in Southeast Asia.
"For the world as a whole, the CIA has now become the bogey that communism has been for America. Wherever there is trouble, violence, suffering, tragedy, the rest of us are now quick to suspect the CIA had a hand in it. Our phobia about the CIA is, no doubt, as fantastically excessive as America's phobia about world communism; but in this case, too, there is just enough convincing guidance to make the phobia genuine. In fact, the roles of America and Russia have been reversed in the world's eyes. Today America has become the nightmare."
L. Fletcher Prouty. (1992). JFK: The CIA, Vietnam, and the Plot to Assassinate John F. Kennedy, (pp. 230, 231)
Additional information about L. Fletcher Prouty
The Dulles Brothers, the CIA, and American Capitalist War Criminals