Swimming is a learned behavior for all dogs. A small percentage, and not necessarily breeds renowned for their swimming abilities, can begin to swim when entering water for the first time.
Dachshunds, pugs and other small dogs have physical and behavioral characteristics that lead to poor swimming abilities. These traits can include short legs, small snouts, thick fur that weighs the dog down and a tendency towards hyperactivity or panic. Labrador retrievers, golden retrievers, Portuguese water dogs, poodles and many other dog breeds have excellent swimming abilities.
In any event, a dog can learn to swim through formal instruction provided by dog trainers or by observing other swimming dogs.