When you're talking in mathematical terms, they mean the same thing.
However,
"The sum of 2 and 3 is 5"
sounds much more natural than
"the total of 2 and 3 is 5" (this sounds odd)
Total is probably the more general term, while sum is primarily, (but not exclusively) used for mathematics.
Take some other example sentences,
"At the end of the day, the sum of our efforts resulted in nothing." (this and the above example are the main uses for the word "sum" that I can think of.
"All together, our fundraising left us with a total of $15,000"
"The total amount of people that came to the party was unknown"