This is because the red and blue lines cross at (0,-2). We don't really need to worry about the y coordinate here. For this problem, all we care about is the x coordinate, which is x = 0.
When x = 0, the outputs of each function f(x) and g(x) are both the same value. So that's why we can say f(0) = g(0). It's the same as saying f(x) = g(x) has the solution x = 0.