The Cosmic Clown is a DC comics super-villain, an alien android designed to be an assassin (apparently one of numerous such "clowns" that were designed for the same nefarious purpose), despite wanting to change to be a better person (or in this case A.I.) he became a classic example of a misguided anti-villain.
Cosmic Clown attempted to kill Prince Konshu of the planet Rotcod, but a bodyguard shot him in the head, resulting in Cosmic Clown drifting into space and spent years recuperating from the damage.
He decided to reprogram himself, and escape his past as an assassin. As a result of this, his clown colleagues wanted him dead, so he fled to Earth.
He landed in Delta City, but believed that the clowns he encountered on Earth were the same as the murderous androids he had once been apart of.
When he saw an advertisement for a clown show at the Breeding-Mosley Circus, he decided to eradicate them to atone for his past.
He met the Heckler, whom he mistook for yet another clown. They fought, and Heckler knocked his head off with a baseball bat.
Cosmic Clown was relentless and continued to pummel Heckler with his decapitated head.
Luckily a nerd named Bob showed up, who believed Cosmic Clown was a character from his favorite sci-fi show, Quest-Vision.
Bob’s toy ray-blaster somehow incapacitated Cosmic Clown, and Bob took the head home as a souvenir.
Cosmic Clown’s head is currently living in Bob’s apartment, and they continually get on each others nerves.