I have been told by a computer scientist that most people in that field believe that algebra was invented (along with algorithms) by the 9th century mathematician Muhammad ibn Musa al-Khwarizmi. (I have no idea what most mathematicians believe about this, if anything.) Yet, the Indian mathematician Brahmagupta gave a clear statement of the quadratic formula over a century before al-Khwarizmi was active. Also, Euclid presents algebra in geometric form in his Elements, and the Babylonians knew how to solve some quadratic equations.
According to the Wikipedia article on Algebra, some have argued that Diophantus is the "father of algebra". (Is that the same as "inventing" it?)
If you google "inventor of algebra", you are told in no uncertain terms that it was al-Khwarizmi. Undoubtedly his book played a crucial role in organizing algebra into a subject (as did Euclid's Elements in geometry), and in bringing these ideas to Europe. But it seems to me that this is far from "inventing" algebra, especially given the previous work of Brahmagupta and others. It is apparently clear that al-Khwarizmi knew of some of Brahmagupta's work, which seems to have reached Baghdad before he was born, but it is not clear if he knew of Brahmagupta's algebra.