Historically, logic and mathematics were separate disciplines and had little to do with one another. Apart from Euclid, few mathematicians were concerned with axioms. Some scholars were good at both logic and mathematics, and a few of those saw a connection between them. Leibniz, for example, had quite a modern approach to logic and supposed that it might be possible to devise a calculus for language that did the same job for logic that mathematics did for arithmetic and geometry.
Arguably, this idea came to fruition in the 19th century with Frege and Peirce and the development of quantifier logic. At the turn of the 20th century, non-Euclidean geometry and Russell's paradox created a crisis in the epistemology of mathematics. Frege and Russell proposed to create a firm foundation for mathematics by showing how it could all be reduced to logic. This project was called logicism. On this account, logic is fundamental and mathematics is founded upon logic axiomatically.
Not everyone agreed. Brouwer, the inventor of intuitionism, considered that mathematics is fundamental and logic is of little interest to mathematicians. Other intuitionists, Heyting and Kleene, developed a distinctive intuitionistic logic that differed from the classical logic of Frege and Russell.
Gödel’s incompleteness results are widely understood to have blown a big hole in the logicist program. There are some neo-logicists who defend a weaker version of the idea that mathematics is founded entirely upon logic, but it is no longer a popular view. Also, some of the axioms that Russell proposed to rely upon, such as the axiom of reducibility and the axiom of infinity are difficult to justify.
Today, intuitionism also is a minority position. Some mathematicians are platonists, others formalists, and there are other options as well. The ability to express a mathematical theory as an axiom system is nice, but hardly essential for it to qualify as mathematics. Gödel’s theorems demonstrate that there are fundamental limitations to what can be achieved using axiom systems.
The upshot is that logic and mathematics are separate but interrelated. Mathematical methods can be used to study systems of logic and say interesting things about their properties. And logic can be used to study the foundations of mathematics. Which you consider to be fundamental is rather a matter of perspective.