Why is Heracles named after Hera if she hated him so much?
Diodorus Siculus tells us that Heracles was originally named Alcaeus and was renamed Heracles1 after he gained glory with Hera's aid:
μετὰ δὲ ταῦτα ἡ μὲν Ἥρα δύο δράκοντας ἀπέστειλε τοὺς ἀναλώσοντας τὸ βρέφος, ὁ δὲ παῖς οὐ καταπλαγεὶς ἑκατέρᾳ τῶν χειρῶν τὸν αὐχένα σφίγξας ἀπέπνιξε τοὺς δράκοντας. διόπερ Ἀργεῖοι πυθόμενοι τὸ γεγονὸς Ἡρακλέα προσηγόρευσαν, ὅτι δἰ Ἥραν ἔσχε κλέος, Ἀλκαῖον πρότερον καλούμενον. τοῖς μὲν οὖν ἄλλοις οἱ γονεῖς τοὔνομα περιτιθέασι, τούτῳ δὲ μόνῳ ἡ ἀρετὴ τὴν προσηγορίαν ἔθετο.
Apollodorus also tells us that Hercules had a different name at birth (Alcides, which means grandson of Alcaeus), but gives a different account of his renaming:
Now it came to pass that after the battle with the Minyans Hercules was driven mad through the jealousy of Hera and flung his own children, whom he had by Megara, and two children of Iphicles into the fire; wherefore he condemned himself to exile, and was purified by Thespius, and repairing to Delphi he inquired of the god where he should dwell. The Pythian priestess then first called him Hercules, for hitherto he was called Alcides. And she told him to dwell in Tiryns, serving Eurystheus for twelve years and to perform the ten labours imposed on him, and so, she said, when the tasks were accomplished, he would be immortal.
I'm pretty sure there's another version of the story, where Heracles gets his name from Apollo, but I cannot remember the source.
1 Literally "Hera's glory"