Saying "the integral is the area under the curve" is a common misconception that needs qualification. More precisely:
- If $f(x)\ge 0$ on $(a,b)$, then the area under the curve is given by $\int_a^b f(x)\,dx$.
- More generally, with no qualifications on the sign of $y=f(x)$, we say that $\int_a^b f(x)\,dx$ represents the (net) signed area under the curve meaning that on subinterval(s) where $f(x)\leq 0$, we think of the integral as "negative area", and on subintervals where $f(x)\geq 0$, we think of the integral as "positive area". Then the integral over the whole interval is the sum of these two.
More precisely, if $f:I\to\mathbb R$ with $I=P\cup N$ and
$$
\begin{cases}
f(x)\geq 0, &x\in P,\\
f(x)\leq 0, &x\in N,
\end{cases}
$$
then
$$
\int_I f(x)\,dx=\underbrace{\int_P f(x)\,dx}_{\geq 0}+\underbrace{\int_N f(x)\,dx}_{\leq 0}.$$
In your example,
$$\int_{-\pi/2}^{\pi/2}\sin x\,dx,$$
we can envision the problem like this
We see that $\sin x\leq 0$ on $[-\pi/2,0]$ and $\sin x\geq 0$ on $[0,\pi/2]$, thus
\begin{align}
\int_{-\pi/2}^{\pi/2}\sin x\,dx=\int_{-\pi/2}^0 \sin x\,dx+\int_0^{\pi/2}\sin x\,dx
=-1+1=0.
\end{align}
From the picture, the "net area" of the $-1$ in red and the $+1$ in green is of course $0$, and the calculus reflects that.
On the other hand, the total area of the shaded region (not signed area) is
$$
\int_{-\pi/2}^{\pi/2}|\sin x|\,dx=\int_{-\pi/2}^0 -\sin x\,dx+\int_0^{\pi/2}\sin x\,dx=-(-1)+1=2.
$$
In this case, we negated the $-1$ area in red to get a $+1$ and then added this to the $+1$ area in green to get a total area of $2$.
So be careful about saying "integral is the area under the curve" without qualification!
You should use the fact that $|x|$ is one linear function for $x \in (-\infty, 0]$ and a different linear function for $x \in [0,\infty)$ to break the interval of integration into subintervals that are easier. For instance,
$$ \int_{-2}^{3} \; |x| \,\mathrm{d}x = \int_{-2}^{0} \; -x \,\mathrm{d}x + \int_{0}^{3} \; x \,\mathrm{d}x \text{.} $$
Best Answer
Your intuition seems to be telling you that the antiderivative of an always-positive function should be always positive. But this is not correct. This is a counterexample. Integrating $x^2 + 1$ is another example: it's antiderivative is $\frac{x^3}{3} + x + C$, which is not always positive.
Instead, the correct property that we should expect is for the function to be always increasing. Starting with a positive function $f(x)$, we know that $\displaystyle \int_a^b f(x) dx > 0$. In particular, this should mean that $\displaystyle F(x) = \int_0^x f(t) dt$, which is the antiderivative, to be a strictly increasing function.
For instance, $\int_a^b f(x) dx > 0 \iff F(b) - F(a) > 0$, so that we see that $F(x)$ must be strictly increasing.
In this case, $\frac{1}{2}x^2 \text{sgn}(x)$ is a strictly increasing function, so that it might be the antiderivative of a positive function (like it is).