See e.g. Carroll's notes: it's the simplest scalar which contains up to second order derivatives of the metric. But maybe 'why' is the wrong question. We don't know 'why'. But it works.
It might be mentioned in this context that many theories of modified gravity instead put a general function ##f(R)##. Of course, to recover GR you need ##f(R) \simeq R## to leading approximation.