Time complexity measures how many operations an algorithm performs. Space complexity measures how much extra memory it needs while running. Both grow with input size, but they answer different questions about cost.
Consider summing an array. You touch each element once, so time is O(n). You only keep one running total, so extra space is O(1). The two numbers move independently of each other.
They often trade against each other. A lookup table can make code faster while eating more memory. Knowing both matters because a program can be quick yet crash by exhausting RAM, or thrifty yet far too slow to use.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.