Have you ever been at the beach and played with wet sand? If you have, then you know that the water can make channels and curves in the sand.
Well, something similar happens when a big piece of land, like a continent, starts to move into another one. The continent that is moving towards the other one starts to compress and fold. It's like pushing a piece of cloth together - it will bunch up and form wrinkles.
As the land continues to push and compress, a big hole can form in front of it. This is called a foreland basin. It's kind of like a puddle on the ground, but much bigger, deeper, and way more complex.
Over millions of years, sediment from the mountains and other nearby land are washed down into the basin, filling it up with rocks, soil, and mud. Sometimes this can be really thick, like a big pile of pancakes on top of each other. This is called sedimentary rock.
The weight of all this sediment pushes down on the earth's crust, making the basin sink even further into the ground. As it sinks, more sediment keeps piling up on top.
Eventually, the basin can get so deep that it begins to fill up with sea water. You might be thinking, "But wait! How can a giant hole fill up with water?" That's because the edges of the hole (or basin) are often high enough to keep the water from running out.
This process can take millions and millions of years. But in the end, you're left with a big, deep hole filled with sediment and layers of rock. And that's what we call a foreland basin.