Because he has talents that could come in useful anywhere
C-3PO may seem bumbling (and is, to a certain extent), but he has the potential to be very useful in contexts ranging from an Imperial data center to a standoff between two species.
C-3PO is a skilled translator
It is often overlooked, because of the comical context in which it is usually presented, but C-3PO really can speak six million languages.
“Goodness gracious me!” exclaims C-3PO. Then, recalling his
programming as a protocol droid and master of six million languages,
he introduces himself.
“Seethreepiowha bo Artoo Detwoowha.” He points to R2 and the eyeball
snakes over to have a look. “Ey toota odd mischka Jabba du Hutt.
Beware the Power of the Dark Side!
This skill could come in extremely valuable in virtually any situation in which a group might encounter a species or culture that does not speak Galactic Basic, of which many have been shown throughout the series. It’s basically the reason that real-life dignitaries and so forth take translators everywhere.
C-3PO’s has achieved quite a lot with his translation skills and knowledge of protocol. For example, he was able to help Riyo Chuchi negotiate peace between the Pantorans and the Talz.

C-3PO’s ability to speak Ewokese certainly was helpful on Endor:
Back in the hut, C-3PO has finished his story.
Chief Chirpa and his two best hunters, Teebo and Asha, are deep in
discussion. Logray, the village shaman, tries to interrupt, which
makes Asha growl and bare her teeth. But Chirpa stops her and lets
Logray speak his mind. There’s no need for us to get into a lot of
Ewok politics now, but it’s really a delicate business.
C-3PO’s story has inspired Chief Chirpa to aid the rebels.
Beware the Power of the Dark Side!
What it comes down to is this: you never know whether you’ll need a translator, but you never know when you’ll need a translator.
He also is a repository of other useful information
C-3PO knows a great many things beside mere languages. This is presumably part of his general knowledge as a protocol droid:
Protocol droids are vital in smoothing differences encountered by the
many farflung cultures interacting on a regular basis throughout the
galaxy. Programmed in etiquette and equipped with formidable language
skills, protocol droids assist diplomats and politicians and also
serve as administrative aides and companions for high-ranking
officials.
Protocol droids don’t just know languages, then (how could they, to be effective diplomats?) They also are familiar with etiquette and other cultural information, as C-3PO demonstrates on various occasions:
“The Niktos served the Hutts for centuries,” C-3PO said to her. Leia
understood this perfectly well, but she didn’t waste time interrupting
him to say so. She knew the droid well enough to be sure he’d keep
talking anyway. “They’ve never had a truly independent government of
their own. Hardly even a world of their own, really.”
Bloodline
He even possess some programming skills
Surprising as it may seem, C-3PO is actually capable of hacking and data analysis (perhaps in part due to being able to "speak" to computers and droids). We learn this early on, when C-3PO explains that he can program binary load lifters. From A New Hope:
THREEPIO (quickly) Sir —not in an environment such as this -that’s why
I’ve also been programmed for over thirty secondary functions that…
OWEN What I really need is a droid that understands the binary
language of moisture vaporators.
THREEPIO Vaporators! Sir —My first job was programming binary load
lifter…very similar to your vaporators. You could say….
Note that he also mentions a variety of other functions here, suggesting that he has many skills.
In “Blue Shadow Virus,” in The Clone Wars, C-3PO analyzes data from a captured Separatist droid:
PADME: I need as much information as possible before the Jedi arrive.
See if you and Threepio can download any of the other battle droid’s
memory.
He can also recalibrate thermal units:
“See-Threepio, human–cyborg relations.” C-3PO performed a little bow.
“Though we have met before, Emissary Yendor. We worked together on
recalibrating the thermal units for Echo Base one afternoon precisely
five days after our arrival on Hoth. May I say it is a pleasure to see
you again?
Bloodline
Perhaps most notably, he extracts some information from an Imperial computer system:

As Han recognizes, you never know when C-3PO will come in handy:
“You, too, buddy,” says Han and this time he does walk away, to climb
into a sluggish stolen shuttle instead of his own ship, to try to
bluff his way past an Imperial blockade, to fight his way across an
alien moon, and to attack a well-defended Imperial outpost with a
handful of soldiers, a Wookiee, a farm boy, a princess, and two
droids.
Thinking about it a second, he isn’t quite sure why he’s bringing
along the two droids…but, he reasons, they might come in handy.
Beware the Power of the Dark Side!
All in all, C-3PO possess an array of skills that could come in useful in a wide variety of situations. Sure, he’s not much good in combat, and he has an irritating personality, but he’s actually quite skilled and knowledgeable.
In the particular case of Jabba’s palace, C-3PO had two advantages. First, he could translate anything that R2-D2 might need translated, as he indeed does:
“Oh, my,” says C-3PO. “Die Wanna Wauaga! We—we bring a message to your
master, Jabba the Hutt.”
“Beep—re-de-click,” adds R2.
“And a gift,” translates C-3PO automatically. Then he looks at R2. “A
gift? What gift?”
Beware the Power of the Dark Side!
Second, having two droids to give to Jabba instead of one would “sweeten the deal.”
“As a token of my goodwill, I present to you a gift: these two droids.
Both are hardworking and will serve you well.”
Beware the Power of the Dark Side!