The discrepancy comes from the way musical intervals are named.

The names are derived from the number of "fenceposts" including the first one, where as the corresponding length of the fence is one unit shorter.
The third+third=fifth equation is thus not $$3+3=5$$ but $$(3-1) + (3-1) = (5-1)$$
The E is counted double in the naïve addition $3+3=5$ because it is counted as the end of one interval and the start of the next interval.
