The compiler manages stack memory for you, while heap memory is something you request and give back yourself.
The stack holds function locals and parameters. Each call pushes a frame, the block that holds that call's locals, and each return pops it. So cleanup is automatic and free. The stack is small, often one to eight megabytes. Deep recursion or a huge local array can overflow it and crash the process.
The heap is a separate pool you allocate from at runtime. Objects there live until something frees them, so they can outlive the function that created them. Allocation costs a real call into the allocator, and memory you never release leaks.
Default to the stack. Use the heap when an object must outlive the current scope or is too big for a frame. Also use it when the size is known only at runtime.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.