Short Answer
It sounds you're struggling to understand the relationship between three fundamental theories. Naive set theory is the theory used historically by Gottlob Frege to show that all mathematics reduces to logic. Type theory was proposed and developed by Bertrand Russell and others to put a restriction on set theory to avoid Russell's paradox, and which was then replaced by ZF and ZFC, but still finds popularity among computer language designers. And category theory has been offered as an alternative to ZFC as a foundational theory, which is powerful in analyzing the functional aspects of mathematical structures and might be seen as an abstraction of set theory. All three theories are related to what Wikipedia calls the Curry–Howard–Lambek correspondence which purports to show how proofs, programs, and category-theoretic are isomorphisms of a sort, and which suggests a deeper interconnectedness between the three.
Long Answer
Sets and Their Problems
There are many theories of math, but set theory (ST), type theory (TT), and category theory (CT) are important because they raise foundational questions and are considered fundamental theories. Naive set theory, for instance, can be used to define numbers and arithmetic. A famous example is von Neumann Ordinals. From Georg Cantor and the use of set theory, the argument actual infinities exist has been made. The problem with naive set theory is that it is possible to derive a contradiction as Russell showed Frege, now known as Russell's paradox. The response led by Russell was to come up with a new system to replace naive set theory, and what he put forth were a series of theories that allow for types. From Linnebo's Philosophy of Mathematics, p. 143:
Gödel goes so far as to claim that set theory is "nothing else but a natural generalization of the theory of types, or rather, it is what becomes of the theory of types if certain superfluous restrictions are removed... One of the "superfluous restrictions" that Gödel has in mind...[is] type theory cannot allow an individual to be a member of a clan directly but only via some family".
The short version is type theory escapes Russell's paradox by creating a strict hierarchy of "sets" so a set cannot be a member of itself which is a presumption that leads to the paradox. For both historical and technical reasons, however, mathematicians chose ZF theory and developed it, eventually accepting an axiom of choice, or others extending it, like in NBG:
Zermelo–Fraenkel set theory is intended to formalize a single primitive notion, that of a hereditary well-founded set, so that all entities in the universe of discourse are such sets. Thus the axioms of Zermelo–Fraenkel set theory refer only to pure sets and prevent its models from containing urelements (elements of sets that are not themselves sets). Furthermore, proper classes (collections of mathematical objects defined by a property shared by their members where the collections are too big to be sets) can only be treated indirectly. Specifically, Zermelo–Fraenkel set theory does not allow for the existence of a universal set (a set containing all sets) nor for unrestricted comprehension, thereby avoiding Russell's paradox. Von Neumann–Bernays–Gödel set theory (NBG) is a commonly used conservative extension of Zermelo–Fraenkel set theory that does allow explicit treatment of proper classes.
An Alternative of Objects and Maps
Category theory is another matter completely, and was invented specifically with looking for generalization among mathematical structures. From WP:
Category theory formalizes mathematical structure and its concepts in terms of a labeled directed graph called a category, whose nodes are called objects, and whose labelled directed edges are called arrows (or morphisms).1 A category has two basic properties: the ability to compose the arrows associatively, and the existence of an identity arrow for each object. The language of category theory has been used to formalize concepts of other high-level abstractions such as sets, rings, and groups. Informally, category theory is a general theory of functions...
Samuel Eilenberg and Saunders Mac Lane introduced the concepts of categories, functors, and natural transformations from 1942–45 in their study of algebraic topology, with the goal of understanding the processes that preserve mathematical structure.
Unlike thinking about the foundations as sets or collections, categorical-theoretic thinking conceives the world of mathematical abstract objects as objects and maps. This lends the theory quite nicely to expression graphically as mathematical graphs. Instead of membership and equivalence as the important relations, mappings and order are seen as primary. Its theoretical defenders believe that this shows mathematics better:
From Conceptual Mathematics: A First Introduction to Categories, p.3:
Our goal in this book is to explore the consequences of a new and fundamental insight about the nature of mathematics which has led to better methods for understanding and using mathematical concepts... While this idea, that mathematics involves different categories and their relationships, has been implicit for centuries, it was not until 1945 that Eilenberg and Mac Lane gave explicit definitions... synthesizing many decades of analysis of the working of mathematics and the relationships of its parts.
Summary
You are correct that set theory, type theory, and category theory are very important to mathematics as part of a philosophical challenge, and all have some relation to foundational questions. Remember that the foundations of mathematics is very important to explain what math 'is', which is contested among philosophers of mathematics. Logicists, formalists, empiricists, nominalists, and others have very different view of what math is and whether or not abstract objects are objective, real, and so on. One good place to get started is 'Philosophy of Mathematics' (SEP). Remember that set theory (by way of ZFC) is important to the logicist program, and category theory appeals to structuralists, both the question of 'what mathematics is' is still a contested question.