When the Earth first formed, about four and a half billion years ago, it was all liquid rock and liquid metal because it was so hot. But when the Earth cooled down, around four billion years ago the igneous rocks formed. That was granite and quartz and lava and other kinds of rock. When the wind blew on these rocks, and when the rain washed over them, little bits of rock gradually broke off. That’s what erosion is.
Little by little, these eroded bits of rock rolled or blew down from the mountain tops to the river valleys. Then the rivers carried the bits of rock along the river valleys to the ocean. The little rocks mixed together to make sand and clay. Or they made mixtures of sand and clay. A lot of the sand and clay ended up on riverbanks and on beaches, where you see it today.
Some of the sand and clay fell into lakes and oceans. Gravity pressed the water down on top of the sand and clay and mashed the particles together into new rocks. These are sedimentary rocks like sandstone (made out of sand) and shale (made out of clay).
Beginning about a billion years ago, there were plants on land. When these plants died, the dead plants mixed with the sand and clay to make dirt. Like the sand and clay, dirt tended to fall or blow down from the tops of hills into river valleys. Then the rivers carried the dirt along the river valleys to the oceans. That’s why when people came along about 150,000 years ago, they found the best land for hunting and gathering, and later for farming, was in river valleys, especially near the ocean. The early cultures of the Egyptians in the Nile valley, or the Sumerians in the valleys of the Tigris and Euphrates rivers, the Chinese along the Yellow River, the Norte Chico in Peru, or the Woodland culture along the Mississippi River, or the Harappans along the Indus river are all examples.