He was assassinated. The killer was never found.
The reasons are unknown although speculation about this subject has become an industry in itself. The only person who could have answered this question is the assassin, Lee Harvey Oswald, who was murdered in the basement of the Dallas police station while in the process of being transferred to another facility two days following the assination. Oswald's murderer, Jack Rubenstein (alias Jack Ruby), was convicted, imprisoned and died of cancer while incarcerated without shedding any light on the subject.