The United States gave support to the “Contra” rebels in Nicaragua because those rebels were fighting against a regime that was heavily influenced by communists and which was friendly with the Soviet Union. Beginning with President Jimmy Carter, American leaders did not want a communist-backed government so near to the United States.
During the Cold War, the United States wanted to contain communism and keep it from spreading into new areas of the world. Therefore, it was willing to support even regimes that had poor records on human rights so long as they were opposed to communism. This was the case in Nicaragua. The US supported Anastasio Somoza even though he was a dictator with a poor record in human rights. Despite the US support, Somoza was overthrown by the Sandinistas in 1979. The Sandinistas were strongly influenced by communism. They then became friendly with the Soviet Union.
The US saw this as a danger to American national security. Therefore, when rebel groups arose, the US supported them. These rebels came to be known as the “Contras,” which was short for the Spanish word for “counterrevolutionaries.” The US supported them in hopes that they would overthrow the Sandinistas and stop the spread of communism.