Before 1959, Cuba was very close to the USA. For example in Cuba there were many USA owned businesses
Socialist revolution
Change in society into socialism which overthrows capitalism
As the USA refused to deal with Cuba's new socialist government, Cuba began to build economic links with the Soviet Union, and the relationship between Cuba and USA decreased
USA refused to recognize Cuba's new government as they did not want a socialist country in their sphere of influence. The CIA ( spy agency for USA ) tried to assassinate Castro but failed
The CIA convinced Kennedy that a US supported invasion of Cuba to overthrow Castro would solve the socialist problem
The CIA told Kennedy that in the Bay of Pigs incident:
Invasion of Cuba could look like a Cuban Revolt, having trained Cuban spies and disguised american aircraft as Cuban
Castros control of Cuba was weak
Most Cubans hate Castro
What actually happened in the bay of pigs incident
US planes were recognized photographed and published, so world knew USA backed the invasion
Castro knew in advance of the invasion and 1400 US troops met 20000 of Castros troops. US troops surrendered
Most Cubans preferred Castro over their previous leader, Batista, who was corrupt
The Bay of Pigs attack led to no chances of a good USA and Cuba relationship.
After the attack, Castro announced that he was a communist and they built stronger ties with the soviet union, such as military defence for Cuba