Equation you have mentioned is balanced chemical equation. In reality these are series of Redox reactions, major two as follows,
Oxidation of oxygen from water in presence of light (energy from photon),
$ 2H_2O \xrightarrow{Photons} O_2 + 4H^*$
Ions produced from above reaction reduces carbon dioxide ,
$4H^* + CO_2 \rightarrow (CH_2O) + H_2O$
So both equations combined, we can write general form as
$nCO_2 + nH_2O \xrightarrow{Photons} (CH_2O)n + nO_2$
In simple words to answer your doubt, in final equation 2 oxygen molecule coming from per 2 $H_2O$ molecules and 1 coming from per $CO_2$ molecule. Hence final balanced equation is
$6CO_2 + 6H_2O \xrightarrow{Photons} 6(CH_2O) + 6O_2$