The answer is pretty much always "Because science."
Dogs have a keen sense of smell, much stronger than humans. So why then, do they use that sense of smell to sniff each other's butts? If you've ever been curious about the science of dog butts then Reactions from The American Chemical Society has the video for you. They explain exactly what dogs are sniffing for, and about their secret second dog nose, the Jacobson organ.