The first way of using gdb is to run your program through gdb; that is great when you know your program is broken and you know where to start looking.
When you have a core file then the 2nd way comes in useful. Actually just loading gdb this way and typing 'where' will tell you most of the time why your program dumped core; although sometimes your program can go so badly wrong it can overwrite the stack so gdb can't figure it out.
Finally you can attach to a running program - say a program appears to have done something wrong but is still running. Try attaching to something like
a text editor.