Use dynamic memory when you don't know the size at compile time. Reading a file of unknown length, building a tree with unknown nodes, or processing user input of variable size all need heap allocation.
Use it when data must outlive the function that creates it. A factory function returning a new object uses new because the object must persist after the function returns. Prefer stack memory when possible.
It's faster and automatically cleaned up. Use dynamic memory only when stack limitations force you to: unknown sizes, long lifetimes, or large objects.