(diagram taken from http://dnowlan.ca/VM/science7/planetearth/rocks.htm)
All rocks used to me magma. Once the magma got out from underneath the earth to become lava, it cools almost suddenly and becomes an igneous rock.
From there, the igneous rock can be transformed into a metamorphic rock by heat and pressure, it can go back into the earth and become magma once more, or it can be weathered* and eroded* to become sediments. Clay is sediments that are stuck together by water.
* Weathering : The process of breaking down rock
* Erosion : Sediments that have been move from their original place where they were weathered.
Once in sediments, they can be compacted and cemented to make sedimentary rocks. Shale is a sedimentary rock because it comes from sediments that are compacted together.
Sedimentary rocks can be weathered and eroded back into sediments, or heat and pressure can turn them into metamorphic rocks.
And finally, metamorphic rocks can be weathered and eroded to become sediments once again, or be melted back into magma.