Evolution is not intelligent in the way humans are, but it is an optimization process. While the causal process may differ, evolution, like humans, makes things in a certain way because it fulfills a certain function. This is what we say when we mean that evolution designs things to do something.
In other words, evolution clumsily finds a local optimum for doing something.