The obligation to donate a half shekel to the Temple had nothing to do with Purim. This began in the desert and was an annual obligation every year during the month of Adar.
Every year starting with Rosh Chodesh Adar, tables were set up all of Israel for the collection of the half shekel. This donation was used for the maintenance of the Temple throughout the year. It was also set up in such a way that all of this money needed to be used up before Rosh Chodesh Nissan.
Shekalim were mentioned in Megillat Esther as part of Haman’s plot. For this reason, we have the custom of giving a מחצית השקל before reading the Megillah.
Rabbi Soloveitchik points out that sin represents selfishness, where sin overrules sacred principles. Giving צדקה as in half shekel, is the opposite. This act demonstrates sympathy, compassion, and sharing with others. This is why forgiveness from sin can only be attained through צדקה.
Charity or מתנות לאביונים is certainly one of the themes of Purim.