So why was Yuri Gargarin the first man in space? Just as important why was he the first man to orbit the earth?
Since the launch of sputnik both the United States and the Soviet Union were in various races. The race to launch the heaviest satellite, a race to reach the moon first by satellite and the race to launch the first man into space.
Alan B Shepard missed being the first main in space by inches. The reason was that during Ham the chimpanzee suborbital flight test the Redstone rocket didn't perform as expected. Chris Kraft, Robert Gilruth and the rest of NASA Langley felt that performance issues were minor and that they could go with the next flight with the rocket design as is. Werner von Braun of NASA Marshall wasn't as confident. He insisted that that one more test flight of the Redstone was needed to verify the fixes and got his way. That flight launched in March 24th 1961. Then on April 12th, Gargin lifted off on the R-7 rocket in the Vostok capsule and made one orbit of the earth. Alan Shepard followed a couple of weeks later in May with the launch of Freedom 7.
Until the day he died Alan Shepard and rest of NASA Langley felt they could have been first if von Braun would have been bolder. The situation is ironic because several years earlier von Braun was able to launch a satellite well before Sputnik using the Jupiter-C missile he was developing for ballistic nosecone re-entry tests. Indeed before one launch a general personally inspected the rocket to make sure that von Braun didn't slip an extra stage to accidentally launch the payload into orbit.
Sputnik was launched, Vanguard failed, and finally the US called on von Braun to launch the Explorer satellite on the Jupiter-C.
But even if Alan Shepard would been the first man in space, Gargarin would been the first man to orbit the earth. The reason lie back in the early 1950 during the development of the Hydrogen Bomb. Due to work of Teller and Ulam the initial weight estimate for the American Hydrogen bomb came in way lower than expected. This came at a crucial time during the development of the ICBM. Since less weight means a cheaper rocket to develop the developers of the Atlas and other rockets eagerly used the new weights for their design.
In contrast the Soviets had to loft a lot more mass for their bomb so Korolev's R-7 was designed to lift a much bigger payload. Eventually the Soviets developed a lightweight hydrogen bomb but now they had the prefect rocket in which to support their space program. This meant the American had to use less powerful rockets for the Mercury capsule until the upgraded Atlas was ready. The Soviets launched their first flight into orbit and Gagarin became the first man into space. That same rocket, the R-7 Semyorka, has been used in the launch of Sputnik and all russian manned flights including the Soyuz flights to the International Space Stations.