How to find the minimum of the integral? Suppose $x(t)$ is differentiable on $(0,T)$ and continuous on $[0,T]$. How to find the minimum and the minimal value of the integral $$\int_0^T\|\dot x(t)+x(t)\|^2dt$$ such that $m\le x(t)\le M$ on $[0,T]$?
 A: Consider the quadratic functional $J_T$ on the Hilbert space $H^1(0,T)$
$$J_T(u):=\int_0^T(\dot u+u)^2dt\ ,$$ 
and let $0<m< M$ be given. The complete picture for the minimization problem of $J_T$ on $\{u\in H^1(0,T)\ :\ m\le u\le M\}$, as $T$ varies, is as follows:

  
*
  
*For $0\le T \le T_0:=\log(M/m)$ the minimum value is $0$, and it is attained by exponentials $ce^{-t}$, with  $me^T\le c\le M$
  Geometrically, the zero set of $J_T$ is a line meeting the convex constraint set in a
  segment, that becomes a single point for $T=T_0$.
  
*For $T_0\le T\le T_1:=\text{arcosh}(M/n)$ there is a unique minimizer, which is a decreasing solution of the free Euler-Lagrange
  equation $\ddot u=u$ with $u(0)=M$ and $u(T)=m$, namely
  $$u_T(t):={m\over\sinh T}\sinh t+ {M\over\sinh T}\sinh (T-t)$$ 
  corresponding to the minimum value $$J_T(u_T)=2{(me^T-M)^2\over e^{2T}-1}.$$ Note that for $T=T_1$ the minimizer is simply
  $$u_{T_1}(t)=m\cosh(T_1-t)$$
  
*For $T\ge T_1$ the unique minimizer is just $u_{T_1}$ prolonged to be constant for $T_1\le t\le T$, namely   $$u_{T}(t)=m\cosh(T_1-t)_+$$
  which is a $C^1$ function since $\cosh(T_1-t)$ has a $0$ derivative at $t=T_1$.
  The corresponding minimum value for $J_T$ then grows affinely:
  $$J_T(u_T)=J_{T_1}(u_{T_1}) +m^2(T-T_1).$$

$$*$$
Details.
More generally for $0\le \alpha\le \beta\le T$ denote
$$J(u,[\alpha, \beta]):=\int_\alpha^ \beta(\dot u+u)^2dt=\|\dot u\|^2_{2,[\alpha,b]}+\| u\|^2_{2,[\alpha,b]} +u(b)^2-u(\alpha)^2\ .$$
The situation being clear for $T\le T_0$, we assume $T>T_0$, that is   case C in Carlo Beenakker's answer. So in the following $Me^{-T}<m$, and $J_T(u)>0$ whenever $m\le u\le M$.
If $u\in H^1(0,T)$ satisfies $m\le u\le M$ in $[0,T]$, but $Me^{-t}\le u(t)$ does not hold for all $t$, then   $$v(t):=\max( u(t), Me^{-t})$$  has $\dot v(t)+v(t)=0$ in the non empty  open set $\{v\neq u\}$, and $\dot v(t)+v(t)= \dot u(t)+u(t)$ a.e. in $\{v= u\}$, so $J_T(v)<J_T(u)$. The same hold, analogously, for $v(t):=\min( u(t), me^{T-t})$.
Therefore, any minimizer of the constrained problem must also satisfy for all $0\le t\le T$
$$Me^{-t}\le u(t)\le me^{T-t}$$
and in particular $u(0)=M$ and $u(T)=m$.
Also, if $u\in H^1(0,T)$  verifies $m=u(T)\le u(t)\le u(0)=M$ and $u$ is not decreasing, by easy intermediate value arguments there are $0\le \alpha < \beta\le T$ such that $$u(\alpha)=u(\beta)=\min_{\alpha\le t\le \beta}u(t)<\max_{\alpha\le t\le \beta}u(t)\ .$$
Then, putting for $0\le t\le T$
$$
v(t):=\begin{cases}
u(\alpha),& \text {if }\  \alpha\le t\le b\\ \\
u(t), &\text {otherwise.}  \\ 
 \end{cases}
$$
defines an element  $v\in H^1(0,T)$, with $m\le v\le M$ such that $$J_T(u)-J_T(v)=J(u,[\alpha,\beta])-J(v,[\alpha,\beta])>0\ ,$$
thanks to the stated identity for $J(u,[\alpha,\beta])$. 
Therefore, any minimizer of the constrained problem must be decreasing  on $[0,T]$.
Finally, if $u(T)=m\le u\le M=u(\beta)$ for some $0=\alpha<\beta\le T$, we can compare $u$ with
$$
v(t):=\begin{cases}
u(t+\beta),& \text {if} \; 0\le t\le T-\beta\\\\ 
m, &\text {if} \;  T-\beta\le t\le T. \\ 
 \end{cases}
$$
Again $J_T(u)>J_T(v)$ follows from the above identity for  $J(u,[\alpha,\beta])$, for
$$J_T(u)-J_T(v)=J(u,[\alpha,\beta])-J(m,[\alpha,\beta])>0.$$ 
Hence any minimizer of the constrained problem is decreasing and verifies $u(0)=M>u(t) \ge u(T)=m$  for $0< t\le T$. In particular, it solves the Euler-Lagrange equation $\ddot u-u=0$ in the interval $(0,\tau)$ (any small perturbation with compact support in $(0,\tau)$ leaves $u$ within the constraints). This gives:
$$u(t):= 
\begin{cases}
{m\over\sinh \tau}\sinh t+ {M\over\sinh \tau }\sinh (\tau-t),& \text {if} \; 0\le t\le-\tau\\ \\
m, &\text {if} \; \tau\le t\le T. \\
 \end{cases}$$
for some $0\le \tau\le \min(T, T_1)$; the corresponding value of the functional is
$$J_T(u)=2{(me^\tau-M)^2\over e^{2\tau}-1}+m^2(T-\tau).$$
To conclude, one has to minimize the above expression w.r.to the parameter $\tau\in [0,\min(T, T_1)]$, finding the minimizer. In fact, it turns out it is decreasing w.r.to $\tau$, so that the minimum corresponds to $\tau=\min(T, T_1),$ ending the computation: one  has:
$${dJ_T(u_\tau)\over d\tau}=-{ \left( {me^{2\tau}-2Me^\tau + m   \over  e^{2\tau}-1 }\right)^2}\ .
$$
(Note that this proves independently the existence of the minimizer, so we could have used piecewise $C^1$ functions instead of $H^1$, where  however existence is also clear by convexity and weak compactness.)
A: Set $x(0)=x_0$ and $x(T)=x_T$, with $x_0,x_T\in[m,M]$. I will first allow for excursions outside of this interval, and then later add the constraint that $m\leq x(t)\leq M$ for all $0\leq t\leq T$.
Minimize 
$$I=\int_0^TL(x,\dot{x})\,dt\;\;\text{with}\;\;L=(\dot{x}+x)^2$$ 
by solving the Euler-Lagrange equation,
$$\frac{\partial L}{d x}=\frac{d}{dt}\frac{\partial L}{\partial \dot{x}}.$$
The solution is
$$x(t)=a e^t+be^{-t},\;\;a=\frac{e^T x_T-x_0}{e^{2 T}-1},\;\;b= \frac{e^{2T} x_0-e^T x_T}{e^{2 T}-1}.$$
The resulting integral is
$$I=(\coth T-1) \left(x_0-e^T x_T\right)^2.$$
We still need to minimize this by varying $x_0$ and $x_T$ in the interval $[m,M]$, at fixed $T$. I assume $M>0$.
We need to consider several cases:A: If $m\leq 0$, we can just take $x_0=0=x_T$ and reach the minimal $I_{\rm min}=0$.
B: If $m>0$ and $T\leq\ln(M/m)\equiv T^\ast$ we can take $x_0=me^T$, $x_T=m$ to reach the minimal $I_{\rm min}=0$.
C: If $m>0$ and $T>T^\ast$ the minimum is reached at the end points of the interval, $x_0=M$, $x_T=m$, with $I_{\rm min}=(\coth T-1) \left(me^T -M\right)^2$. In the limit $T\rightarrow\infty$ this tends to $I_{\rm min}\rightarrow 2m^2$.

Now I add the constraint that $x(t)$ should be in the interval $[m,M]$ for all $0\leq t\leq T$. Cases A and B still apply. Case C no longer applies, because that trajectory drops below $m$ and then returns back up. I don't yet have a satisfactory proof, but believe the minimum is given by:
C': If If $m>0$ and $T>T^\ast$ we take
$$x(t)=\begin{cases}
Me^{-t}&\text{for}\;\;0\leq t<T^\ast\\
m&\text{for}\;T^\ast+\epsilon\leq t\leq T
\end{cases}
$$
and allow the velocity $\dot{x}(t)$ to drop to zero smoothly in the infinitesimal interval $(T^\ast,T^\ast+\epsilon)$. In the limit $\epsilon\rightarrow 0$ this has no effect on $I$, which stays at 
$$I_{\rm min}=(T-T^\ast)m^2.$$

Lower bound on $I$
$$I=\int_0^T (\dot{x}+x)^2\,dt=\int_{0}^T(\dot{x}^2+x^2)\,dt+x_T^2-x_0^2$$
$$\qquad\geq\int_{0}^T x^2\,dt+x_T^2-x_0^2\geq (T-\tau)m^2,\;\;\text{with}\;\;\tau=(M/m)^2-1.$$
This time $\tau$ is well above $T^\ast=\log(M/m)$, so my estimate $I_{\rm min}=(T-T^\ast)m^2$ leaves room for improvement, as indicated by Pietro Majer.
