Dogs wag their tails as a way to communicate their emotions and feelings to other dogs and humans. A wagging tail can indicate happiness, excitement, friendliness, or even nervousness. It is a form of body language that helps dogs express themselves and interact with others in their environment.