A 21-gun salute is a show of respect to dignitaries or leaders of state. The origin of the ceremonial procedure came from a signal a warring faction gave to the other side that they mean no harm.