The above is a useful overview of what we know about the first invention of fire by early humans and its effects on mankind’s evolution. The earliest definitive use for fire use is around a million and a half years old, but phylogenetic analysis puts the invention of fire further back to around two million years ago, this is corroborated by the anatomical characteristics of species like Homo erectus, with reduced jaws and teeth that in some cases were the size of the teeth of modern people, as well as more reduced musculature compared to the non-human great apes and a far bigger brain in relation to body size than australopithecines, our ancestors, and great apes, with cranial capacity reaching up to 1100 cm.
The earliest evidence for habitual fire use dates to around 500,000 years ago, and we have indirect evidence that we were making glue from around this time too, see the article for more details on that. There’s some evidence both Neanderthals and early modern humans practiced fire stick farming from at least 120,000 years ago, and there’s evidence of leather working from around this time, for those who don’t know leather requires fire to make, and there’s also evidence for hand drills from around 400,000 years ago as well, instead of simply using the friction from rubbing two sticks together in an hearth on top of some kindling to ignite a fire, which is presumably the first method we devised for actually making fire.
We likely had the ability to control fire before we invented methods to ignite it, this would require knowledge of slow-burning materials to maintain fires for long periods of time, animal dung does the trick.