optimal substructure
Suppose the cheapest road trip from your home to a distant city happens to pass through a particular town along the way. Then the portion of that trip from your home to that town must itself be the cheapest way to get from home to that town. If it were not — if there were a cheaper way to reach the town — you could swap it in and make the whole trip cheaper, contradicting that you had the best route. This 'the best whole is built from best parts' phenomenon is called optimal substructure.
Stated carefully, a problem has optimal substructure when an optimal solution to the problem contains within it optimal solutions to its subproblems. This lets you express the best answer for a problem in terms of the best answers for smaller versions, which is exactly the recurrence at the heart of dynamic programming. The argument that establishes it is almost always a cut-and-paste proof: take a claimed optimal solution, suppose some embedded piece were not optimal for its own subproblem, paste in a better piece, and show the whole solution would improve — a contradiction. For the longest common subsequence of two strings ending in the same letter, an optimal alignment must use that shared last letter and then align optimally what comes before, or you could lengthen it.
This property is what makes the greedy paradigm and dynamic programming possible, and its absence is informative too. Longest simple path in a graph famously lacks optimal substructure: a longest simple path from A to C through B need not split into a longest A-to-B path plus a longest B-to-C path, because the two halves can share vertices and break the 'simple' (no-repeat) condition when combined. So you must verify optimal substructure with a real argument, not assume it — it can quietly fail.
Shortest paths have optimal substructure: if the shortest path from s to t goes s -> u -> ... -> v -> t, then the piece from s to v is a shortest s-to-v path. Cut-and-paste: a shorter s-to-v piece pasted in would yield a shorter s-to-t path, contradicting optimality. This is exactly why relaxation-based algorithms work.
Cut-and-paste turns 'a sub-piece is not optimal' into a contradiction, proving optimal substructure.
Optimal substructure is necessary for both greedy and DP, but it does not by itself tell them apart — greedy additionally needs the greedy-choice property, while DP only needs you to try all the subproblem combinations. And it can fail (longest simple path), so prove it.