The Evolution of Whales 
Morphologically, the evolution of whales was determined to have begun within an extinct group of carnivorous hooved animals called Mesonychids. These include the fossils like Sinonyx, Andrewsarchus, and Pakicetus, which is generally considered to be ancestral to whales. 
UNGULATOMORPHA (hooved animals)
.|--Altungulata
|--Mesonychia (Mesonychids)
.`-Cetartiodactyla
...|-Cetacea (whales)
...|.|--Pakicetidae
...|.`--+--Ambulocetidae
...|....`--+--Remingtonocetidae
...|.......`--Autoceta 
...`-Artiodactyla ("even-toed" hooved animals)
.....|--Suina 
.....|..|--Hippopotamidae
.....|..`--Suoidea  
.....`--Selenodontia 
........|--Camelidae
........`--Ruminantia 
...........|--Giraffoidea 
...........`--+--Bovoidea 
..............`--Cervoidea
Pakicetus
Pakicetus and Diacodexis represent the very base of theirs clades, Cetacea and Artiodactyla
-sisters in the composite clade, Cetartiodactyla.
Mesonychids are just one of several whole lines of early mammals which are now completely extinct, and have never been seen alive by modern man.  So we don't have their DNA on file.  Genetically, the closest living terrestrial relative to whales is the hippopotamus, another hoofed mammal which has been known to eat meat on occasion.  Pigs are also closely-related to hippos, and they frequently eat meat also.  Taxonomically, hippos and pigs (Suiformes) are a sister taxon to whales, both of which descend from the same line which also lead to Mesonychids.  So the genetic confirmation still makes sense.   
These early Mesonychian four-legged terrestrial predators were identified as 'whales' due to a number of distinct features, all of which are unique to whales alone; One of those is the shape and structural subtleties of the elongated skull.  The teeth also are quite distinct among among mammals in that they are especially primitive, mostly-unspecialized, triangular, shrew-like, almost reptilian teeth, just like those of some modern whales.  No other mammal had teeth like this since the days of the dinosaurs.  But the most distinctive feature was the inner ear.  Whale ears are unlike those of any other mammal on Earth in a number of ways.  And pakicetus had the ears of a whale. 

Pakicetus lead to another Mesonychid, Ambulocetus, "the walking whale", which is believed to be the beginning of Cetacea, because (apart from the length of the legs) its skeleton already looks like that of a whale.  The only other difference is that modern whales lack any sort of pelvic structure.  But as you can see below, the pelvis of ambulocetus is already dramatically diminished compared to that of any other land mammal.   
There are many transitional links in the apparent line between extinct Mesonychids and modern whales, 
Cladistic Taxonomy
including






Pakicetus








Ambulocetus









Rhodocetus







Protocetus













Dorudon













Basilosaurus







and
Aetiocetus

In fact, there are still more than that, and even more than are listed in this chart (at right) too.  But some of them are quite fragmentary and illustrations don't yet exist for many of them.

That was actually my initial goal in getting into paleontology.  Too many of the illustrations we do have aren't precise detail-accurate depictions as I would rather they all be.  Scientists have myriad minute details to indicate which fossils are in what part of what sequence; subtle shapes in the inner ear, the teeth, the position of the nostrils, (which we see in this sequence moving to the top of the head) and condition of the pelvis, etc. Layman can only judge by the pictures, so those images should be as realistic as possible.  In general, artists aren't scientists and scientists aren't artists.  But I am both, and I am looking forward to the day when I can work with the actual fossils instead of mere images of them.
(also known
as zoogolodon)
One of the many bits of demonstrable evidence in this are the flippers of all whales living or extinct.  They still have fingers, all of them.  They're all concealed beneath a single paddle of skin now, but beneath that there is still a complete pentadactyle (five-fingered) hand. 

So all of the known whale ancestors and every known whale today has the vestigial remnant of its "hands" still intact.  But what about thier feet?  Many of the transitionals in this sequence still had their hind-limbs too where no modern cetacean does.  Is there any evidence from other sources besids the fossil record which insist that modern whales once had hind flippers?

Of course there is.  A new field of evolutionary science, called "evo-devo" -reveals where ancestral phylogeny is illustrated by parallels in delopment from an embryo. In the case of dolphins, the hind flippers are still visible as budding feet in the early stages of embryonic development and are absorbed back into the body as the animal matures.  But on some very rare occassions, a now-recessive gene can be switched back on, so that one out of millions of adult dolphins might have four flippers!
Biology is full of bizarre curiosities like these. 
Evolution is the only explanation ever offered for any of them,
and it accounts for all of them. 
Take for example, the narwhal, as weird a whale as you'll ever see alive.  They're very rare, and good pictures of them are especially rare because they live primarily in the arctic circle where the water is too cold for most divers interested in underwater photography.  The narwhal is a small whale, related to the baluga, and only about 15 feet long.  Their most notable feature is a single tusk of up to 8 feet long which is the only straight tusk known in all of nature.  It is typically indicative of males, but very rarely a female will have one too.   
Having any evidence of hind-flippers is rare in dolphins otherwise.  But other modern whales still have tiny vestigial hind-leg bones disconnected from the rest of the skeleton and suspended in the flesh.
It is a very weird tusk not only because all of them seem to twist to the left, and all of them seem to be constructed inside-out, and because it appears to be an unusual sensory organ.  But also because its asymetrical.  Its an overgrown incisor which doesn't protrude out of the mouth, but grows out of a hole punched through the whale's upper lip. 
In some relatively rare instances, a narwhal will have two tusks. Whenever this happens, the tusk on the left is always longer than the one on the right.  The fossil record gives us a hint as to how the narwhal might have evolved.  Odobenocetops is a "walrus-like dolphin" known only from fossils of the early Pliocene period roughly 3 to 5 million years ago.  Odobenocetops is on a different branch than the narwhal.  But it also had tusks, typically two of them, and they were of unequal length.  But curiously, the right tusk is always significanly longer than the one on the left. 

Odobenocetops did not elvolve into narwhals.  But they're close cousins sharing the same genetic disposition for incisors growing out-of-control; a trait elephants have also.
One thing the fossil record shows is that more genera have gone extinct than are still around today.  Yet look at the incredible diversity of life in every clade alive.  Evolution is the only explanation for this.