In general, you have a bilevel optimization problem in which the inner problem is maximum of g with respect to x, subject to 0≤x≤10, is ≤ 0.8. If you want to read all about bilevel optimization, here is an expensive book "Practical Bilevel Optimization" by Bard https://www.springer.com/us/book/9780792354581 .
One easy but not completely rigorous way to deal with this is to make the g constraint into n constraints, one for each of n grid points for x in [0,10]. For instance, with grid spacing of 0.01, there are 1001 such constraints. And also −10 ≤ x1 ≤ −0.5 and 0 ≤ x2 ≤ 20. The objective function is −x1∗x2. This is a non-convex optimization problem, so you'll have to use a global optimizer to ensure finding the global minimum.
You could use FMINCON to solve this formulation, but that is a local optimizer, so you might not find the global optimum. You could install YALMIP. then use BMIBNB (global optimizer which comes with YALMIP), specifying FMINCON as the upper solver.
Here is the YALMIP code your example in the comment:
x1 = sdpvar;
x2 = sdpvar;
x = 0:.01:10;
Con = [-10<=x1<=-0.5,0<=x2<=20,-(1+x1)/x1.*x+x1+5*exp(-(x-15).^2/50)<=0.8];
This example is quickly solved, with resulting optimal x1 = -10, x2 = 0. Actually any x1 in the range $-10 \le x1 \le -1.125$, which are the feasible values of x1, is optimal in conjunction with x2 = 0. This is a very easy problem to solve to global optimality. A little theoretical analysis could probably arrive at this solution for this example without the need for numerical optimization.