They all map through production function to output $Y$. Since output is produced from these factors we have
$$Y=f(K,L,E,N,...)$$
Where, $K$ would capital, $L$ labor, $E$ would be entrepreneurship and $N$ nature - you can also include any arbitrary number of factors and also note while entrepreneurship is in some textbooks considered factor, nature is often just included under the land label.
The right hand side of the identity is all determined by output.
Consumption is determined by output as its function of disposable income based on output. A simple undergraduate example would be:
$$C=c_0+c_1(Y-T)$$
Where $c_0$ and $c_1$ are parameters $Y$ is output and $T$ taxes. You can have more complex consumption functions but they will all be functions of $Y$.
Investment $I$ depends on the $c_1$ parameter which determines what proportion of income people save. That is $(1-c_1)Y=S$ where $S$ is saving and $I=S$ (assuming balanced budget).
$G$ is again determined by the output - in the long run government can only spend maximum what the society can produce and what government can extract from society through taxes $G=T$.
$X-M$ tracks the movement of some of the home output abroad and import of some of the foreign output.
So to sum up, the factors of production map to GDP as they through production function map to $Y$ and the right hand side of the equation is just all determined by what $Y$ is.