Saigo Takamori from the Satsuma clan was once serving the shogunate but he quit his job and joined the imperial forces.
He led the imperial army against the shogunate and was the most important commander during the Boshin war that resulted with the fall of the shogunate in 1867.
However, later he disagreed with the emperor and launched the samurai rebellion in Southern Japan.
The samurai rebellion was crushed by the imperial army (300,000 men vs 40,000 men) and Saigo Takamori reportedly committed seppuku dying as a true samurai.
***The last samurai movie was not based on a true story since there was no American commander during the Boshin war. However, there was a French commander who fought against the emperor in Northern Japan, temporarily founded the government of Ezo, but eventually lost and left Japan.