Was maths invented or discovered? The answer to this question is actually quite nuanced. Some will say it’s both, some will say neither.
Maths comes from us, humans, and our magical minds. But it cannot be a pure invention, since we see maths everywhere in the universe, from the way plants grow to the way the planets move.
Patterns in the universe have been there since the beginning of time. That's what we’ve discovered. We then needed a way to think clearly about them, to write logical proofs that everybody could understand, and that's why we invented the language used to describe these patterns. This language is what most people simply call 'Mathematics'.
Mathematicians and philosophers have had this debate for a long time, and most of them, as you probably guessed, chose a side.
For example, Bertrand Russell wrote The Principles of Mathematics, where he writes at length about how mathematics is discovered. You could even say that, on his view, the very language we use to describe the laws of the universe is, in some sense, discovered. Maybe it was always part of us, and what we really discovered is the way our mind is structured; and that this language just came to us naturally, as the only way to think clearly enough to keep discovering.
A nice counterpoint is Henri Poincaré. He argued that in mathematics we invent the frameworks and concepts, even if those "inventions" are then constrained by logic. He took the non-Euclidean geometries as an example of this. For him, we don't just find geometry lying out there; we create different systems, and then choose the ones that is the most elegant and useful to describe the world around us. Almost like mathematicians don't study "things", but the relations between them; and that those relations and the structures we define, are largely product of our minds.
For me, when asking whether maths was invented or discovered, we're missing the point entirely. The truth is that mathematics lives exactly in that tension. When you solve an equation, prove a theorem or even just balance a budget, you’re doing both at once. You’re using a human-made language, but you’re pushing up against constraints you didn’t choose. Something answers back.
We invent the symbols; the universe decides which equations stay true.