You should understand graph basics and recursion. DFS explores as deep as possible along each branch before backtracking to try other paths. It's naturally implemented with recursion (using the call stack) or an explicit stack data structure.
BFS and DFS solve different problems optimally: BFS finds shortest paths in unweighted graphs because it explores level by level, while DFS is better for exhaustive exploration, cycle detection, and finding any path.