Here's an alternative definition of "topological space".
A topological space is a set $X$ together with a relation "___ is near ___" between points and subsets of $X$. The relation satisfies:
- No point is near the empty set
- If $P \in A$, then $P$ is near $A$
- $P$ is near $A \cup B$ if and only if $P$ is near $A$ or $P$ is near $B$
- If $P$ is near $A$ and every point of $A$ is near $B$, then $P$ is near $B$
That's it — a topological space is just a set of points together with a "nearness" relation that satisfies these axioms.
Then, an open set is simply a set whose points are not near its complement.
From one point of view, the purpose of topological space is to cut out all the extraneous information — many things can be stated and proven just in these terms, such as limits. Sometimes, this makes it easier to state and prove things. Other times, it lets us generalize.
For example, consider the extended real numbers. Its underlying set $\bar{\mathbb{R}}$ and consists of the real numbers $\mathbb{R}$ along with two extra points, which we will call $+\infty$ and $-\infty$.
One basis for the topology of $\bar{\mathbb{R}}$ is intervals of the form
- $(a,b)$ for (finite) real numers $a$ and $b$
- $(a, +\infty]$ for (finite) real numbers $a$
- $[-\infty, b)$ for (finite) real numbers $b$
You remember all of the different versions of "limit" you learned in introductory calculus, such as
$$ \lim_{x \to +\infty} \frac{x^2 + 1}{x + 2} = +\infty $$
? It turns out all of these are the same definition of limit, but applied to the extended real numbers rather than the ordinary real numbers.
Now, you could achieve the same thing talking only about metric spaces, but it would require inventing a new metric (e.g. $d(x,y) = |\arctan(x) - \arctan(y)|$, where we define $\arctan(\pm \infty) = \pm \pi/2$) and then you'd have to prove things about how the new metric relates to the usual metric and stuff, so it would be complicated and potentially confusing.
Topological spaces can also be applied to settings where it's not clear how to define a metric, or even when you can't even apply the notion of metric space at all.
An important example is used in algebraic geometry, one aspect of which is about studying solutions to polynomial equations. One defines the Zariski topology on the plane $\mathbb{R}^2$ to be the topology generated by a basis of open sets given by inequations of the form $f(x,y) \neq 0$, where $f$ is a polynomial in two variables.
In the Zariski topology, the set of points
$$\{ P \in \mathbb{R}^2 \mid \|P\| \neq 1 \}$$
is an open set (being the solution space to $x^2 + y^2 \neq 1$), however the set of points
$$\{ P \in \mathbb{R}^2 \mid \|P\| <1 \}$$
is neither open nor closed.
Nearness in the Zariski topology has nothing to do with distance; instead it has more to do with how you can extend solution sets to polynomial equations; e.g. the point $(2, 0)$ is near the line segment from $(0,0)$ to $(1,0)$, because every polynomial that vanishes on that line segment (e.g. $y$ or $3y + x^2 y$) also vanishes at the point $(2,0)$.