Roughly it goes like this.
Hausdorff (and others at the time) considered "manifolds" $M$, where for each point $p \in M$ there are "coordinate neighborhoods" which are in 1-1 correspondence with neighborhoods in Euclidean space. A function $f : M \to N$ is continuous at a point $p \in M$ if there are coordinate neighborhoods $U$ of $p$ and $V$ of $f(p)$ so that the corresponding map in Euclidean space is continuous.
Then Hausdorff made the leap that you did not need the coordinates to define continuity, it was enough to have "neighborhoods" that mapped into one another appropriately. Hausdorff's definition of such spaces was in terms of neighborhoods, not in terms of open sets.

When other abstract definitions of "topology" were proposed (in terms of open sets, in terms of convergence, in terms of closure operation, etc.) it turned out that Hausdorff's definition was equivalent to theirs, except for the need of an additional restriction (which is nowadays called the Hausdorff condition).