Direct limit of topological spaces
Take $X=\mathbb{N}$ with the cofinite topology and $X_i = \{1,\dotsc,i\}$. Then each $X_i$ carries the discrete topology, and it follows easily that their colimit $\varinjlim_i X_i$ also carries the discrete topology. But the union $\cup_i X_i$, equipped with the subspace topology, actually equals $X$ and doesn't carry the discrete topology.