It was replaced. We don't know why or how, yet, but the WGA script explicitly notes that:
EXT. D'QAR - DAY
The Millennium Falcon RISES.
Leia, with Poe, BB-8, and C-3PO (with his proper arm replaced), watches the next generation of Jedi begin her journey.
We know it was replaced AFTER the attack on Tacodana:
C-3PO
Goodness! Han Solo! It is I, SeeThreepio!
(sees Han, stops)
You probably don't recognize me because of the red arm.
(sees Leia, increasingly awkward)
Look who it is! Did you see who?
Oh. Excuse me, Prin-- uh, General.
Sorry. Come along, BB-8. Quickly.
(BB-8 beeps)
Yes, I must get my proper arm reinstalled.
Please note that the red arm clearly wasn't there because it was the best functional choice: Visual Dictionary says:
“C-3PO is uncharacteristically quiet when it comes to discussing his salvaged arm; it is a memento of another droid's sacrifice,”
Of course, the real reason is that now, Disney can sell twice the C-3PO centric (or even C-3PO involving) merchandise.