Today I saw movie "Gagarin" and in the bus scene towards the first flight; there were two cosmonauts.
If Gagarin was chosen to fly first then why was the second guy present? What was his name?
As was common for spaceflight, there was a primary crew for the mission (Gagarin) and a backup. Gagarin was the primary crew, and his backup was Gherman Titov (who would fly Vostok 2 four months later). Both of them prepared for the mission in the same way, down to having the same schedule the day before and being transported to the launchpad together. So it sounds like the film was accurate in this regard.
So why was he there? Titov will have been present up to the last minute in case of an accident or a problem - imagine that Gagarin had stumbled and injured himself when entering the spacecraft, or that he had felt unwell at the last minute. Having the backup present and prepared means that they could just step up and take over; if he had stayed at base drinking coffee, you would probably have had to cancel the launch and try again the next day.