the (mostly) non-mathematical answer is that any time we have a field in physics, there will be defined for that field an associated quantum, which can be considered an excitation of that field. when that field is responsible for transmitting forces between objects, that process can be modeled as the exchange of those quanta between those objects. For the electromagnetic field, the associated field quantum is the photon. for the gravitational field, the associated field quantum is the graviton.
the mathematics of the process by which a certain field is quantized defines the characteristics of the quantum of that field. Even before we go out and try to catch one of those quanta as it propagates through the universe, we know in advance what its properties are.
in the case of the electromagnetic field, the quantum of the field must be massless and possess a spin number of one. for the gravitational field, it too must be massless and have a spin number of two.
in studying how gravity works, we can visualize the process of gravitational forces acting between two massive objects as occurring because mass bends spacetime and thereby alters the trajectories of those objects, or equivalently by visualizing it involving instead the exchange of gravitons between those objects.