Carlson is not a particularly important character in Steinbeck's Of Mice and Men. Steinbeck had his ending already well in mind while he was writing the earlier chapters of the novel. He intended to have George kill Lennie. He also wanted this act to come as a surprise to the reader. It is by far the most poignant moment in the novel. Two friends are being hunted down in their hiding place by the beautiful river, and one of them has to kill the other to save him from worse treatment at the hands of an angry mob.
But Steinbeck had to establish how George got hold of a gun. In Carlson he created the kind of man who was likely to carry a gun around on his travels. It is a German Luger, possibly something Carlson acquired as a trophy while serving in the army in World War I. He uses it to shoot Candy's dog, but the important thing is to establish that the gun exists, that George knows where it is kept, and that George sees how to load and unload it.
When Lennie kills Curley's wife and runs away to hide in the place George told him to go to in case of trouoble, Carlson's gun is found to be missing. It is assumed that Lennie stole it. The reader doesn't know--although he may suspect--whether it is really George who has it.
Steinbeck gives an elaorate description of how Carlson cleans and oils his pistol after killing the dog. Here are a couple of sentences from the entire paragraph devoted to this procedure:
Carlson found a little cleaning rod in the bag and a can of oil. He laid them on his bed and then brought out the pistol, took out the magazine and snapped the loaded shell from the chamber.
George observes all of this and knows how to cock and fire a foreign gun when the time comes. This is practically the only purpose for the episode about Carlson killing Candy's dog. Candy later says he should have killed his dog himself. This may plant the seed of an idea in George's mind. Lennie is as trusting as Candy's old dog when it is taken outside to be shot.
Carlson is a hard man who likes owning a gun and doesn't mind killing animals, but he is only important in the plot because he owns a gun that is accessible to George when he needs it.