In short, the UN forces were able to drive North Korean forces out of South Korea. They then began advancing into North Korea. At this point China entered the war (under the guise of the PVA) on the side of the North Koreans, which was not something which had been anticipated. This resulted in several defeats, and the UN forces being pushed back towards the prewar boundary. MacArthur wanted the option to expand the scope of the war by using nuclear weapons against North Korea and northern China, which Truman didn't want because he was afraid that doing so would mean full-scale war against China and the USSR, and possibly an invasion of Europe by the latter while the US was tied down in Asia. The Wikipedia links posted by some of the other users make for interesting reading.
It should also be noted that North Korea, while the instigator of the war and a Communist country, was in a very different position in the 1950s. It was a richer country than South Korea until the 1970s, and South Korea at the time was an American-backed military dictatorship. While there may have been a moral argument to roll back Communism as far as possible, Truman's concerns about the geopolitical implications of expanding the war were very real, and calling them cowardice is a rather crude mischaracterization.