The gun represents violence, a tool built for one specific reason -- to kill. The animals, at first, embrace the commandment in the Laws of Animalism: "No animal shall kill any other animal." In this spirit, after the Battle of the Cowshed, the gun is set up as a memorial, symbolizing the defeat of humans by the animals.
It was decided to set the gun up at the foot of the Flagstaff, like a piece of artillery, and to fire it twice a year...
(Orwell, Animal Farm, msxnet.org)
Later, as Napoleon takes more and more control over the farm, the gun becomes a propaganda tool, and it is fired on Napoleon's birthday, at parades, and even when the farmers destroy the windmill, to trick the animals into thinking that they were actually victorious. Like other symbols in the story, the gun is used by Napoleon to further his agenda, and so its initial placement changes from a victory trophy to a symbol of oppression.
In Chapter Four, the gun (which once belonged to Mr. Jones) is placed at the foot of the flagstaff. This is significant because it symbolizes that the rebellion is complete: the animals have not only overcome Mr. Jones but have also overcome his attempt to retake control of the farm. By placing the gun in this position, they are celebrating their independence and providing a visual reminder of their success in creating their own republic.
It is also worth noting that by placing the gun in this position, they are creating a symbolic link between the republic and the use of violence. Later in the novel, when Napoleon takes complete control of the farm, he will fire this gun at events that are important to him, like his birthday. In doing this, Napoleon changes the gun's significance from a celebration of independence to a symbol of his total power and control.
The significance of the gun's placement at the foot of the flag pole to show the victiories of the Rebellion and the Battle of the Cowshed (when they got the gun). It is to be fired twice a year on those dates, and later in the story to also be fired on Napoleon's birthday.