The short answer
Your downspout is dumping water next to the foundation because it's missing an extension, the extension came off or cracked, or a buried drain line is clogged. All three end the same way: rainwater soaking the soil right against your wall.
That's the worst place for it. The soil around a foundation is backfill, meaning it was dug up and dumped back in when the house was built, so it's looser and thirstier than the ground beyond it.
Water pools there, saturates the soil, and pushes against the wall. Over a few seasons that pressure finds cracks and gets inside.
The good news: this is one of the cheapest, highest-payoff fixes on the whole house. Most of the time you're moving water 4 to 6 feet with a part that costs under $30.
What's actually going on
In most homes, this comes down to a missing or broken extension. Builders often leave downspouts with just a short elbow that dumps at the wall, and homeowners pull off extensions to mow and forget to put them back.
The second big one is a clogged underground line. Plenty of homes route downspouts into buried 3 or 4 inch pipe. Over years that pipe fills with silt, roots, and leaf sludge, and once it backs up, water surges out at the top of the connection (right where you don't want it).
A stuck pop-up emitter causes the same backup. The little hinged lid at the end of the buried run jams with dirt or freezes shut, and the whole line backs up to the downspout.
Then there's grading. Even a good extension fails if the soil slopes back toward the house. Backfill settles over the first decade and quietly builds a bowl around the foundation.
Least common but real: an undersized downspout that can't keep up in a downpour, so the gutter overflows and water sheets down the wall. You'll only catch this during heavy rain.