Given $L$-the length of a curve (single-valued function) passing trough the points $x_1$ and $x_2$ on the $x$-axis. What is the curve $y(x)$ maximizing the area between this curve and the $x$-axis?
The solution is, of course, well known: one formulates a variational problem with a constraint
$ F[y,y']=\int_{x_1}^{x_2}\left(y+\lambda\sqrt{1+y'^2(x)}\right)dx, $
which yields an equation of circle $(x-x_0)^2+(y-y_0)^2=r^2$ as a solution. On the final step, one finds the unknown constants $x_0$, $y_0$, and $r$ by requesting that the circlular arc goes through the points $(x_1,0)$, $(x_2,0)$, and has the length $L$.
The solution is clear to me for $0\le L\le \pi/2(x_2-x_1)$. But what if $L>\pi/2(x_2-x_1)$ ? To my opinion, there is a discrepancy between the length as computed via the integral and the length obtained by imposing the boundary conditions. This is illustrated in the second panel. What is the solution in this case?

To understand what happens consider a simpler example (due to Weierstrass), where we minimize the length of graphs of $C^1$ functions that vanish at the ends and pass through $(1/2,0)$. It should be clear intuitively that the solution is a broken line with a pair of line segments, connecting $(0,0)$ to $(1/2,0)$, and $(1/2,0)$ to $(1,0)$. But this "solution" is not in $C^1$. In the Weierstarass example we can fix this by passing from $C^1$ to the space of absolutely continuous functions $W^{1,1}$ ($L^1$ with derivatives in $L^1$), to which the broken line belongs. But even this will not help in the Dido problem (the OP example) for $L>\pi/2$, which is a good illustration of the limitations of the classical calculus of variations.
By shifting and scaling we can assume that $x_1=0$, $x_2=1$, and formalize the problem as finding $y\in W^{1,1}([0,1])$ that maximizes $A[y]=\int_{0}^{1}y\,dx\to\max$ with the constraints $y(0)=y(1)=0$ and $\int_{0}^{1}\sqrt{1+y'^2(x)}\,dx=L$. If $L\leq\pi/2$ the solution is a circular arc as in the OP Fig. 1. But if $L>\pi/2$ there is no solution. Of course, there are functions in $W^{1,1}([0,1])$, or even in $C^1([0,1])$, with arbitrarily large lengths that vanish at the ends. But it does not mean that there is any among them with the largest possible area. The underlying reason is that balls in $W^{1,1}$ are not weakly compact, so sequences of functions with bounded length may not have (relevantly) convergent subsequences. A simple example is the sequence $x^n$, lengths of the graphs converge to $2$, but the limiting function is not continuous, $0$ everywhere but $1$, and $1$ at $1$. To see that it is the "limit" we need to "add" a vertical segment at $1$ to the graph. Limits of absolutely continuous functions can be discontinuous functions of bounded variation, and for them the length functional ought to be redefined, it is not given by the integral.
The same happens in the Dido problem. For $L>\pi/2$ the solution is not a circular arc, but a pair of vertical segments at the endpoints (they pick up the excess in length) topped with a semicircle, similar to the dashed shape in the OP Fig. 2, except for the topping. An intuitive way to see this is to imagine that the graph represents a flexible but unstretchable membrane attached to a solid wall (the $x$-axis) at the endpoints, and the area in between is being filled with water. To enforce the condition that the curve is a graph we also have to put up two vertical solid walls at the endpoints. The water will tend to maximize area by pushing the membrane equally in all directions, this creates the semicircular topping, but on the sides it can only flatten it along the walls.
An alternative way to formalize the problem is to remove the requirement that the curve is a graph by considering parametric curves, as suggested in the comments to the OP. In that case the vertical walls are removed, and the solution will again be a circular arc, as the intuition suggests (solid and dashed parts above the $x$-axis in the OP Fig. 2). Thus, we get two different solutions for $L>\pi/2$ depending on how the problem is made precise beyond the differentiable functions.
A very good exposition of the history of and subtleties in variational problems, including the Dido problem, is Tikhomirov's Stories About Maxima and Minima