The Galaxy Gun was a superweapon employed by the reborn clone of Emperor Palpatine. Palpatine didn't die at Endor, and had been staving away using the Dark Side of The Force. His subconscious and soul entered a waiting clone body. It was a much younger (mid 20s) body. Palpatine then retook the Empire and led it to the brink of victory.
He turned Luke to the Dark side, by summoning him to Byss. Luke knew he couldn't defeat Palpatine outright, so he joined the Dark Side. When Leia eventually broke Palpatine's grip on Luke - Palpatine used the Galaxy Gun to threaten the galaxy.
After Palpatine was killed (for the final time) - the Galaxy Gun launched a projectile headed for Coruscant - but was sucked in by Byss's gravity - which cultivated in the destruction of the Emperor's stronghold and the entire planet.