Matter produces gravity.
We don't exactly know how this works because we do not have a sufficiently detailed theory of gravity that covers the graininess of matter and energy in a 'quantum theory of gravity'. Geodesics are geometric objects which represent the straightest possible line that can be drawn between two points, so whenever you talk about what geodesics look like, you are invoking the geometric description of gravity and not its familiar Newtonian description in terms of forces. Your question is now equivalent to asking why it is that on a flat piece of paper, a straight line is 'straight'. It is the result of the fact that the backgroud space is the way it is.