# Why are Regular sets not closed under infinite unions and intersections? [duplicate]

Why are Regular sets not closed under infinite unions and intersections, with my flawled reasoning I came to a conclusion that since infinite unions can have no relationship between strings of a language hence it must be regular but the opposite is infact true, can you please help me understand why so, and under what conditions is generally a language considered regular then (apart from the obvious reasons, a Finite automata can be drawn, regex can be written, a set has to be finite)?

Look at $$\ell=\{a^p\mid p\text{ is prime}\}.$$

This language obtain from infinite union of $$\bigcup_{i\geq 2, i\text{ is prime}}^{\infty}L_i$$ Where each $$L_i=\{a^i\mid i\text{ is prime}\}$$ that have one word.

Another example is $$\{a^nb^n\mid n\in\mathbb{N}\}$$ That isn't regular and we can describe it by infinite union of regular languages $$\bigcup_{i\geq 1}^{\infty}a^ib^i=a^1b^1\cup\dots.$$ Each $$a^ib^i$$ is language that have one word.