Can anyone explain simply what each side was fighting for during the bakumatsu period in Japan? For the longest time I assumed that it was about modernizing vs keeping the country closed and that the Imperialists were for modernization, but recently learned that both sides were anti-foreigner and the imperialists changed their mind after the war. So what was the war really about?
The bakufu side was actually not anti-foreign, or at least not actively and officially anti-foreign. It was already decided in the autumn of 1867 (a few months before the Boshin War) that a new government centered around the court of the emperor would be the new form of government. The fighting was basically over who was going to be in charge of the new government, the old rulers or the upstarts. I wrote about this in Why did the Satsuma and Choshu domains have to "capture" or "kidnap" the Emperor of Japan to kick off the Meiji Restoration? Although the question is about a single event in a very confusing time period, it touches upon what went on and what led to the Boshin War.
You might also be interested in my answer in During the Bakumatsu period in Japan, the anti-Tokugawa side of the conflict seems to have been motivated primarily by a desire to keep western influences away from the country. And yet, after their victory, Japan went on to embrace western culture even more. What explains the shift in attitude?