Let $A$ be a proper non-empty subset of $\mathbb{R}^n$. If $A$ is closed then Tietze's extension theorem shows that $C(A,\mathbb{R}^m)$ can be identified with $C(\mathbb{R}^n,\mathbb{R}^m)$. However, if $A$ is open, this is not so in general.
For example, if $A=(0,1)\cup (1,2)$ then there the function $f= I_{(0,1)} + 2I_{(0,2)}$ is in $C(A,\mathbb{R})$ but cannot be extended to a function in $C(\mathbb{R},\mathbb{R})$. Conversely however, every function in the later space restricts to one from the former.
My question is, if $A=\bigcup_{n=1}^N A_n$ where, $A_n$ are pairwise disjoint open subsets of $\mathbb{R}^d$, then is every function in $C(A,\mathbb{R}^m)$ of the form $$ f = \sum_n f_n I_{A_n} , $$ where $f_n$ is a continuous function on $\mathbb{R}^d$?
Not really. The theorem states that $C(A,\mathbb{R}^m)$ can be identified with a subset of $C(\mathbb{R}^n,\mathbb{R}^m)$. Or more precisely that there is a function $F:C(A,\mathbb{R}^m)\to C(\mathbb{R}^n,\mathbb{R}^m)$ with the property $F(f)_{|A}=f$. In particular $F$ is injective. But such bijective function cannot exist if $A$ is a proper closed subset of $\mathbb{R}^n$, since every continuous function $A\to\mathbb{R}^m$ admits multiple (infinitely many) distinct extensions to $\mathbb{R}^n$.
This already fails for $N=1$, e.g. $f:(0,\infty)\to\mathbb{R}$, $f(x)=1/x$. And so this fails for any $N$ (even infinite) simply by taking $N$ open distinct subsets of $(0,\infty)$ with $0$ being a limit point of one of them.