system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why did Russia invade Afghanistan in 1979?

What promoted it? What did Russia hope to gain? Why did it end?
gpt
Afghanistan just underwent a coup and there was an Insurgency going on. The new afghani government asked for help from the soviets who flew in, killed the president and replaced him with a socialist Guy and then took over  a country that had no army to fight. That didn't go so well with the rest of the world. Remember that at that point we are still in the whole proxy-war area where zones of influence are determined. 

Said Insurgency was still going on, with plenty of aid from the US, and after facing a similar scenario the US did in Vietnam (lots of casualties against a para-military force) they withdrew when a new Guy in Moscow took charge who decided that the huge army there was not worth the cost (in money and diplomacy) so they left. Shortly after, the Insurgency took over, what we now know as Taliban, until the US rained down some Freedom and we are back at Square 1, powerless central government vs Isurgency.