Literally, the word "mujahideen" comes from the same Arabic root as jihad, which means "struggle." Thus, a mujahid is someone who struggles. In the context of Afghanistan during the late twentieth century, the mujahideen were Islamic warriors defending their country from the Soviet Union, which invaded in 1979 and fought a bloody and pointless war there for a decade.
Afghanistan's mujahideen were an exceptionally diverse lot, including ethnic Pashtuns, Uzbeks, Tajiks and others. Some were Shi'a, sponsored by Iran, while most factions were made up of Sunni Muslims. In addition to the Afghan fighters, Muslims from other countries volunteered to join the mujahideen ranks. Much smaller numbers of Arabs (like Osama bin Laden), fighters from Chechnya, and others rushed to the aid of Afghanistan. After all, the Soviet Union was officially an atheist nation, inimical to Islam, and the Chechens had their own anti-Soviet grievances.
Foreign governments also supported the mujahideen in the war against the Soviets, for a variety of reasons. The United States had been engaged in detente with the Soviets, but this new expansionist move angered President Jimmy Carter, and the US would go on to supply money and arms to the mujahideen through intermediaries in Pakistan throughout the conflict. (The US was still smarting from its loss in the Vietnam War, so did not send in any combat troops.) The People's Republic of China also supported the mujahideen, as did Saudi Arabia.
The Afghani mujahideen deserve the lion's share of credit for their victory over the Red Army, however. Armed with their knowledge of the mountainous terrain, their tenacity, and their sheer unwillingness to allow a foreign army to over-run Afghanistan, small bands of often ill-equipped mujahideen fought one of the world's superpowers to a draw. In 1989, the Soviets were forced to withdraw in disgrace, having lost 15,000 troops plus 500,000 injured. For Afghanistan, it was a bitter-sweet victory; more than 1 million Afghans were dead, 5 million were refugees, and in the wake of the war, political chaos would allow the fundamentalist Taliban to take power in Kabul.