Aim of this work is to determine C, N, and O abundances in stars of Galactic open clusters of the Gaia-ESO survey and to compare the observed abundances with those predicted by current stellar and Galactic evolution models. In this pilot paper, we investigate the first three intermediate-age open clusters. High-resolution spectra, observed with the FLAMES-UVES spectrograph on the ESO VLT telescope, were analysed using a differential model atmosphere method. Abundances of carbon were derived using the C2 band heads at 5135 and 5635.5 {AA}. The wavelength interval 6470- 6490 {AA}, with CN features, was analysed to determine nitrogen abundances. Oxygen abundances were determined from the [O i] line at 6300 {AA}. The mean values of the elemental abundances in Trumpler 20 as determined from 42 stars are: [Fe/H] = 0.10 +- 0.08 (s.d.), [C/H] = -0.10 +- 0.07, [N/H] = 0.50 +- 0.07, and consequently C/N = 0.98 +- 0.12. We measure from five giants in NGC 4815: [Fe/H] = -0.01 +- 0.04, [C/H] = -0.17 +- 0.08, [N/H] = 0.53 +- 0.07, [O/H] = 0.12 +- 0.09, and C/N = 0.79 +- 0.08. We obtain from 27 giants in NGC 6705: [Fe/H] = 0.0 +- 0.05, [C/H] = -0.08 +- 0.06, [N/H] = 0.61 +- 0.07, [O/H] = 0.13 +- 0.05, and C/N = 0.83 +- 0.19. The C/N ratios of stars in the investigated open clusters were compared with the ratios predicted by stellar evolutionary models. For the corresponding stellar turn-off masses from 1.9 to 3.3 solar masses, the observed C/N ratio values are very close to the predictions of standard first dredge-up models as well as to models of thermohaline extra-mixing. The average [O/H] abundance ratios of NGC 4815 and NGC 6705 are compared with the predictions of two Galactic chemical evolution models. The data are consistent with the evolution at the solar radius within the errors.