Someone became a samurai by learning some mental and physical techniques for fighting in battles. Such as, how to fight, how to take self-control of themselves, and how to get rid of fear. Things like these is what they had to learn.
The samurai were trained mentally and physically because when they would go to battle, they would have to be skilled in fighting to not suffer dying.
Bushido is "The Way of the Warrior."
The samurai will also have to be so loyal to his lord that he would gladly die for him. In addition, samurai were also expected to guard their personal honor.
Seppuku or ritual suicide was the price for failing to live up to the code of Bushido. Samurai would perform seppuku to atone for a crime, a shameful deed, or an insult to a person of higher rank. Seppuku became an elaborate ceremony where the samurai killed himself by stabbing a sword right in his stomach trying to make a whole circle with the sword in their stomach and then someone would cut their head off quickly.