Then my question is how can function occur in the natural world without intent.
Natural selection explains why that function is kept once it occurs.
Think of it like this: a space of N dimensions, for N properties, with an infinite number of values for each.
Small variations (genetic mutations) of each of these property values, will move the position of the system in this N dimensions space. Initially, most of the parameters are null. But, there's a clear trajectory, or a set of possible trajectories from the initial position to the position where, by a certain combination of parameters, a function occurs.
When there's intent, it's very easy to see the path from A to B. But when there's no intent, and not foreknowledge of the possibility of a particular function (a special position in the N space), finding that particular spot by random variations sound enormously improbable.
Does this low probability have a name or something?