Yes the Last Samurai had a kernel of truth, but it was not about an American guy, it was a bunch of French officers who deserted to help the Shogun in exchange of him proclaiming a republic. It has all the elements of an epic movie, including a desperate boarding of an ironclad by a samurai-French force that was repelled by a gatling gun: https://en.wikipedia.org/wiki/Battle_of_Miyako_Bay
https://en.wikipedia.org/wiki/Republic_of_Ezo
Yes the Last Samurai had a kernel of truth, but it was not about an American guy, it was a bunch of French officers who deserted to help the Shogun in exchange of him proclaiming a republic. It has all the elements of an epic movie, including a desperate boarding of an ironclad by a samurai-French force that was repelled by a gatling gun: https://en.wikipedia.org/wiki/Battle_of_Miyako_Bay