I am studying slice knots, so for example they say the cone on a trefoil knot can be embedded in D^4 but it is not locally flat at the vertex of the cone. What I do not understand that I think every surface which is embedded in D^4 is already flat. What prevents the cone to be flat at the vertex? after all in D^4 we have enough room to slide the surface over its intersections it may have in three dimension and so it does not have any intersections with itself, doesn't this mean that it is flat?(if we want to think about smoothness then it seems that even if it is not smooth at some point then we can make it smooth at that point easily). I maybe wrong about the ways a surface can be non-smooth. So one more question can you give me an example in lower dimensions, so that for example a curve which can be embedded in R^3 but it is not flat (or non smooth, say)?

Locally flat is equivalent to flat in this instance, which means the embedding $D^2\subset D^4$ extends to an embedding $D^2\times D^2 \subset D^4$. This is a topological assumption which replaces the theorem (inverse function theorem) that smooth embeddings are always locally flat. As mentioned above, the cone on a trefoil is not locally flat, and is not a smooth embedding at the cone point: the definition of smooth embedding requires in particular that the differential be injective.

There are no similar lower dimensional examples, but another kind of (continuous, not smooth) lower dimensional non-locally flat example is obtained by taking a sum of infinitely many smaller and smaller trefoil knots limiting to a non-smooth point.

If you look at the link of the summit of the cone (that is the intersection of a small 3-sphere centered at the summit with the cone-surface), then it is again a trefoil. If your surface were smooth, it would just be a trivial knot. Indeed, if you take the link a point on $\mathbb R^2$ in $\mathbb R^4$, its link is a trivial knot.

Flat means that the embedding $S\to\mathbb D^4$ is locally modelled on the standard embedding $\mathbb R^2\subseteq\mathbb R^4$.

Also, it is *not* true that in 4-dimensions we have enough room to eliminate self-intersections of a surface (since $2+2\not<4$), and this is one of the reasons that four-dimensional topology is special.