What goals did the U.S. have for the Korean War?
This is a great question. There are several reasons why the United States got involved in the Korean War. First, a little historical context would be helpful.
This was when the cold war with Soviet Union was underway. So, the United States desired to stop the spread communism at all costs. The world was being divided among the two superpowers. After China cast their lots with the Soviet Union and the Soviet Union obtained an Atomic bomb, the United States did not want that whole region in that area to fall into communism. They needed a check to the spread of communism and Korea was that check.
Second, the United States at that point had a policy (the Truman doctrine - March 12, 1947) that stated that the United States would help Greece and Turkey to fight against communism. Some scholars say that this policy was extended to other nations as well - Korea included.
Finally, the United States wanted a strategic Asian presence in that area.