A function $f$ of an open set $U\subset \mathbb{R}^n$ into $\mathbb{R}^m$ is smooth if it has continuous partial derivatives of all orders. We may extend this definition to an arbitrary subset $X$ in $\mathbb{R}^n$ if $f$ may be locally extended to a smooth map on open sets.
My question is why is this extension necessary? What is the issue with defining smoothness on arbitrary sets to begin with?
Among other things, it's due to how we define connectedness: we say a space is connected if it can't be split up into a union of disjoint open sets. (Edit: on reflection, I think this is a disingenuous thing to say, and it's more to do with continuity and differentiability, but hopefully the approximate idea still holds...)
Why do we do this? Well, let's try just using arbitrary sets: I can split $\mathbb{R}$ up into the two sets $(-\infty, 2] \cup (2,\infty)$, for example. Then it's easy to find a smooth function on $(-\infty, 2]$ and a smooth function on $(2,\infty)$, and 'glue' them together to get a function on $\mathbb{R}$... but in general, this function won't be smooth at the point $2$. The same thing happens if you use $(-\infty, 2] \cup [2,\infty)$, even if you insist that the two functions agree on their overlap.
If I try to split $\mathbb{R}$ up into open sets, though, they'll always have some 'breathing room' in their overlap. For example, in the decomposition $(-\infty, 3) \cup (2,\infty)$, we have some wiggle room between $2$ and $3$. Now, given any smooth function on $(-\infty, 3)$ and any smooth function on $(2,\infty)$ that agree on their overlap, we can 'glue' them to a function on $\mathbb{R}$ that is still smooth. (You need that 'breathing room' to be able to take the derivative of each function inside the set it's defined on.)
You should be able to generalise this notion to $\mathbb{R}^n$, and prove the following: smooth functions defined on open sets (which agree on their overlaps) can be glued together to give smooth functions.
More generally, a lot of abstract topological notions (topologies themselves, continuous functions, connectedness, compactness...) rely on open sets, for essentially this reason.