After the overthrow of the Democratic Government in Cuba in 1959 by the communist forces led by Fidel Castro, the small island country was instantly put in the middle of the cold war chaos. The island nation of Cuba is just miles away from the US mainland, the epicenter of the fight against communism. The coup took place when Franklin D. Eisenhower was the president and is considered by many pundits for the reason he didn't stand for another term. So, now there was a hostile communist nation just miles away from the US.
A plan was devised in the last days of the Eisenhower administration to overthrow the Fidel regime in Cuba. The plan was made along with CIA, US military, Pentagon officials and other high ranking US government officials. The key aspect of the plan was that under no situation the overthrow of Castro should look as American military action and should rather be portrayed as a revolution by the Cuban exiles. Hence no US military installations/equipment should be used in the invasion of Cuba. Due to administrative hurdles, the strategy couldn't be executed under Eisenhower term and Kennedy was briefed on the plan. The Kennedy brothers were keen on overthrowing the Castro and hence gave the plan green signal.
The invasion would take place by approx. 3000 exiled anti-Castro Cubans from the South American country of Nicaragua. According to the strategy devised the run-up for the invasion would take place on September 15, 1960, misleading the Cubans about the exact location of the starting point of the invasion.However, even in the beginning, the CIA got the intuition that Cubans are much well prepared than they previously thought as the Cuban Expeditionary Force (CEF) ended up losing their key vessels in the run-up. On 17 September, the actual day of the invasion the CEF lost their communication tools in the beginning, which hindered their capability of a coordinated response to Castro militias. Due to this, a major chunk of the CEF was destroyed in the beginning and the air cover then had was also mostly ineffective as they were not able to coordinate with the ground forces for the strategic bombing locations.
Therefore, the "Bay of Pigs" mission to invade Cuba had a humiliating end with a large number of casualties on both sides and a decisive Castro regime victory. The director of CIA along with deputy director resigned in the follow-up days of the invasion as an outfall of the failed invasion.