The US got into the Vietnam War because it wanted to prevent communism from spreading throughout the world.
The US first got involved by helping France to fight against Viet Minh insurgents. The US felt that helping France keep Vietnam would help keep France economically and politically strong. This would help France serve as a bulwark against communism in Europe and prevent it from falling apart and possibly going communist itself.
After France left Vietnam, the US felt it important to continue to fight communism in Vietnam. The US felt that if South Vietnam fell to communism, other countries in the area would fall as well in a domino effect. Therefore, the US kept fighting.
Thus, both of the US's reasons for getting into the Vietnam War had to do with preventing the spread of communism.