Frogs developed out of lungfish about 375 million years ago, and they used their lungs to leave the water and live on land. It was hotter and drier on Earth than usual, because a lot of the land was gathered together into one continent, Gondwana. So a lot of smaller seas were drying up, and the fish in these seas needed another way to live. When the frogs first came out on the land, the only animals that were already living on land were insects, so frogs learned to eat insects, and that's still the main thing that frogs eat.
But when the tadpoles are about two months old, if it's warm enough, they turn into frogs (If it's cool, the tadpole figures there's plenty of water and just stays a tadpole). The tadpoles begin to make a hormone that turns on various genes and makes the tadpoles grow legs and arms, and gradually lose their tails and their gills and begin to breathe air. Adult frogs have good eyes and ears, and an excellent sense of taste in their long tongues.
Being able to survive on land was a big advantage for frogs, and they did pretty well. But frogs still had to live close to water. They lay their eggs and their sperm in the water to make new tadpoles, and the tadpoles have to live in water. Also, frog hearts don't pump blood with oxygen in it to their bodies very well, because frog hearts mix blood with oxygen in it and blood without. To make up for this problem, frogs also can breathe air through their skins - but only if their skin is wet.
To find out more about the evolution of frogs, check out these books from Amazon.com or from your library: