Oh boy. There’s books and books going on about this topic. I’ll try to condense this as much as I can.
Before the late 19th century, mathematics wasn’t anywhere near as rigorous as it is today. There were a lot of things that were assumed to be true because no one had seen a counterexample, and a lot of ideas that were used just because they worked and not because they were actually consistent.
There were a few events that kinda kicked this viewpoint in the teeth. First, Weierstrass published a proof that a particular function is continuous over R, but not differentiable anywhere. That flew in the face of what everybody “knew” as true and caused considerable discomfort.
Second, non-Euclidean geometry, which had originally begun as a project to find an inconsistency in geometries that rejected the parallel postulate, was completely failing to do so.
Third, one of Dedekind’s students asked him what a real number is and he had no answer. That led him to define real numbers in terms of rational numbers, which led to the question of what rational numbers are.
Fourth, Cantor published his theory of infinite sets, which ruffled a few feathers.
Fifth, Russell came up with his famous paradox, which showed that the naive concept of a set was incorrect.
So the classical notion of mathematics was looking like it was in trouble. Meanwhile, the logicians were having a grand old time of publishing very rigorous stuff, which gave Russell the idea to try to reduce math to logic. Peano’s axioms were one of the starting points for that project.
Here’s a question back at you: what does well-formed mean?