The Ran notes that there is a concept (Bamidbar 15:16) that there is one Torah and one law for all Jews. In other words, there should ordinarily be only one day for all Jews to celebrate together. For this reason, Mendel Weinbach notes, usually, according to Halacha (Mishna Berura 688:12), where one spends Purim determines when one will celebrate it. For example, a Jew visiting a walled city temporarily nevertheless celebrates it there for purposes of achdus (“unity”).
R’ Betzalel haKohen of Vilna, however, writes that this distinction is meant to stress that Purim is a d’rabbanan (“rabbinic”) holiday, since the Torah’s (Devarim 13:1) prohibition to add to the given mitzvos only applies to d’oraisa (“Scriptural”) laws.
A story is told of a visitor from Bnei Brak in the home of R’ Shlomo Bloch in Yerushalayim. R’ Bloch invited him to drink at his Purim feast (on Shushan Purim), but since he had already drunk the previous day, the visitor argued that he had already fulfilled the mitzva of drinking on Purim. R’ Bloch retorted, “You may have fulfilled Purim, but you can still fulfill the mitzva of feeling another Jew’s joy.”
The Chasam Sofer gives another reason to have two days of Purim – to avoid bitul Torah. Since the Mishna (Avos 1:2) teaches that Torah is one of the three foundations upon which the world stands, if there were (chas v’Shalom) one moment when nobody was learning Torah, the world would cease to exist immediately. With the advent of Shushan Purim, while one group is drinking and celebrating, the other group can uphold the world by learning.