Dear Jérôme, I doubt that Grothendieck ever said that.
However, in an analogous vein, Jean Leray, a brilliant French mathematician, was taken prisoner by the Germans in 1940 and sent to Oflag XVIIA ("Offizierslager", officers' prison camp) in Edelsbach (Austria), where he remained for five years till the end of WW2.
He managed to hide from his captors that he was an expert in fluid dynamics and mechanics, lest they would force him to contribute to their war effort (submarines, planes).
Instead, he organized a course, attended by his fellow prisoners, on the foundations of Algebraic Topology, a harmless subject for applications in his eyes. It is in these courses that he introduced sheaves, cohomology of sheaves and spectral sequences.
His strategy worked out fine since these discoveries didn't play any role in the construction of weapons by the German enemy, who never cared about Leray's courses and findings. On the other hand, these theoretical tools have had a non entirely negligible role in pure mathematics since.