What is the intuition behind the definition of both topological space and measurable space?

In Rudin real and complex analysis the following two definitions are given (the $\sigma$-algebra is called measurable space:

I wonder what is the reason of requiring for topological spaces to have finite intersections of open to be open and union of any kind of collection to be open. While in the measurable space the countable union of measurable sets must be a measurable set. I mean what is the reason of requiring being countable, finite or uncountable in the two definitions. I'm asking because I always forget about which one and what is finite, which one and what is not etc. Maybe an intuition could help me to remember them.

The short answer is that there might not be intuition of the kind your looking for in the definition. Below I will try to explain my understanding of the definitions and the reasoning for them.

Let me start with measurable sets. The motivation here is to have a generalization of Riemann Integration from calculus. Recall that for a function $f$ (say continuous with domain $[0,1]$ for simplicity) the integral is defined as:

$$\int_0^1f(x)dx = lim_{\Delta x\rightarrow 0}\sum_{i=0}^n f(x_i)(x_{i+1}-x_i)$$

There are many simple functions (characteristic function of $\mathbb{Q}$) for which the right-hand limit doesn't make sense in that it depends on the choice of $x_i$. The key thing to notice though is that $f(x_i)$ is a value of the function in the interval $[x_i,x_{i+1}]$ and $(x_{i+1}-x_i)$ is the length of that interval.

So you can think of the integral of a function over some domain, $[0,1]$ in this case, as a process:

1.) Divide the domain of your function into disjoint pieces

2.) Pick a point in each piece

3.) Multiply the value of the function by the "size" of the piece

4.) Sum these values

5.) Take the limit of the above number as the "size" of the pieces go to zero.

So in order to do this in a general manner we need a consistent way to assign a "size" to subsets of the domain. In the case where the domain is $\mathbb{R}$ it turns out that there isn't a way to do this for $\textit{all}$ subsets of $\mathbb{R}$ so we have to settle for some smaller collections of subsets. It turns out the the $\sigma$-algebra generated by the open intervals is the correct one to look at.

So with the intuition that the measurable sets are the ones we can measure the "size" of the axioms make sense. The first is that we can measure the "size" of the whole set. The second axiom is noting that if we have a set $A$ then the size of $A^c=X\setminus A$ should just be $size(X)-size(A)$ so we can measure the size of $A^c$ as well. The last one is the tricky one and there isn't much intuition to give apart from saying that it's the one that works. Specifically, if we only allow countable unions then you don't get the limits to work out well enough for integrals to make sense and if you allow uncountable unions then, since you want a point to be measurable (it's size should be 0), then that means everything is measurable and for some fairly deep reasons this is not possible.

Finally a word about topology. The definition is very general and also there is also a dual definition (you give the one for open sets but it could be defined by closed sets as well, in which case you would swap the role of intersection and union in the definition.

Topology was originally called Analysis Situs (Position Analysis) and was primarily about metric spaces, and continuous functions on them. The continuity of a function $f$ between metric spaces depends not on each $f(x)$ but on the behavior of $f$ on (ever-smaller) nbds of $x$ :

That is, a function $f$, between metric spaces, is continuous at $x$ iff for every sequence $(x_n)_n$ converging to $x,$ the sequence $(f(x_n))_n$ converges to $f(x).$ Hence the idea of a "small" nbhd of $x:$ An open ball $B_d(x)=\{y:d(y,x)<r\}$ for (any) $r>0.$ The intersection of infinitely many of these may be just $\{x\},$ so if $x$ is not an isolated point of the space, the set $\{x\}$ is of no use for studying the continuity of $f$ at $x.$

If you keep the example of the "standard" ("usual") topology on $\mathbb R$ in mind, you should be able to remember that an intersection of infinitely many open sets may not be open, as it may contain just one point (and 1-member subsets of $\mathbb R$ are not open sets.)

The def'n of a topological space is extremely broad. It includes spaces which cannot be described in terms of convergent sequences. In a metric space we can define convergent sequences topologically: $(x_n)_{n\in \mathbb N}$ converges to $x$ iff $$\cap_{n\in \mathbb N}Cl(\{x_m:m\geq n\})=\{x\}$$ iff for every nbhd $U$ of $x,$ the set $\{n: x_n\not \in U\}$ is finite.

(... $Cl(A)$ is the closure of $A,$ often written $\bar A.$... A nbhd $U$ of $x$ is a subset of the space such that $x\in V\subset U$ for some open $U.$)