If U is a open subset in $\mathbb{R}^n$ and p is a point in U, then tangent space of U at point p is the whole of $\mathbb{R}^n$.
I am having difficulty understanding why this is true. Why is the same not true for closed sets or any set which is not open?
The dimension of a tangent space is the dimension of the underlying manifold and the $n$-dimensional submanifolds of $\mathbb{R}^n$ are precisely the open subsets.
If the set is not open, then at some boundary point of the set, the tangent space is either not well-defined (because the set is not a manifold around that point), or if it is, then it is a manifold of dimension less than $n$.
All claims are immediate from the usual definitions of manifold etc.