Quote from Wikipedia
Fidel Castro took power in Cuba after the Cuban revolution of 1959 and soon took actions inimical to American trade interests on the island. In response, the U.S. stopped buying Cuban sugar and refused to supply its former trading partner with much-needed oil.[1] The U.S. government became increasingly concerned about the new Cuban government, and this became a major focus of the new Kennedy administration when it took office in January 1961.[2] In Havana, one of the consequences of this was the fear that the U.S. might intervene against the Cuban government. This fear materialized in April 1961 when Cuban exiles, trained by the U.S. Central Intelligence Agency, staged an invasion of Cuban territory at the Bay of Pigs. Although the invasion was quickly repelled, it intensified a buildup of Cuban defense that was already under way. U.S. armed forces then staged a mock invasion of a Caribbean island in 1962 called Operation Ortsac. The purpose of the invasion was to overthrow a leader whose name was, in fact, Castro ("Ortsac" spelled backwards). Although Ortsac was a fictitious name, Castro soon became convinced that the U.S. was serious about invading Cuba.[3] Shortly after the Bay of Pigs invasion, Castro declared Cuba to be a socialist republic and entered close ties with the Soviet Union leading to a major upgrade of Cuban military defense. In February 1962, the U.S. began an economic embargo against Cuba.[4]