If you have the derivative of a function, you normally can take the antiderivative in order to find almost the exact original function (say almost since any number that doesn’t have a variable would just have C replace it since we can’t calculate that without more numbers to plug in) but how can I take the derivative function: g’(x)= -512-x^3 and the maximum of g(x) being -7 to find the function?

the maximum occurs when g'(x) = 0, and that happens when x = -8

so, f(-8) = -7
Thus, g(x) = -512x - 1/4 x^4 + C
and since g(-8) = -7, C = -3079
That makes g(x) = -1/4 x^4 - 512x - 3079