The Flesh was a living substance used by humans to create clone workers known as Doppelgängers (“Gangers" for short) for dangerous labour, such as the mining of acid in the 22nd century.
While humans acknowledged the Flesh was alive, they did not consider it a sentient or intelligent life form. They compared it to moss. Miranda Cleaves explained that the Flesh knew how to mimic life, but did not actually know how to be alive.
The Doctor, on the other hand, was not sure. When he scanned the Flesh with hissonic screwdriver, he was surprised to note it responded with a scan of its own. When he touched it, he noted he felt a consciousness in the flesh that investigated him curiously when he made contact. He told the others that the Flesh might have a consciousness of its own, but not one that humans could understand; each time they made clones it learned more about humans.
The Doctor eventually discovered through his and the other Gangers that the Flesh indeed had a sentience of its own that it was only just beginning to actualise. It was in great pain because it recalled the deaths of the Gangers born from it. This was evident during Ganger decommissioning when the Ganger’s eyes would ask, “Why?” (TV: The Almost People)