If you're comfortable with exponentials of linear maps/matrices, then this answer might be helpful.
Theorem: Let $A \in M_{n \times n}(\Bbb{R})$ be a given $n \times n$ matrix, and consider the differential equation $\xi' = A \xi$. Then, every solution $f: \Bbb{R} \to \Bbb{R}^n$ of this ODE is of the form
\begin{align}
f(t) = \exp(tA) \cdot \eta
\end{align}
for some $\eta \in \Bbb{R}^n$. (the $\cdot$ that appears here is matrix multiplication)
There are a couple of facts you need to know. The first is that for any $t \in \Bbb{R}$, the matrix $\exp(tA)$ is invertible and its inverse is $\exp(-tA)$. So, to prove this theorem, let $f: \Bbb{R} \to \Bbb{R}^n$ be any solution to the above ODE. Define a new function $g: \Bbb{R} \to \Bbb{R}^n$ by
\begin{align}
g(t) = \exp(-tA) \cdot f(t)
\end{align}
Now, you need to know a bit about multivariable calculus and the "generalised product rule", and you also need to know how to differentiate matrix exponentials. The results are pretty much the same as in single variable calculus, but their proofs require a bit more care. We have that for every $t \in \Bbb{R}$,
\begin{align}
g'(t) &= \left(\exp(-tA) \cdot (-A) \right) \cdot f(t) + \exp(-tA) \cdot f'(t) \\
&= - \exp(-tA) \cdot A \cdot f(t) + \exp(-tA) \cdot \left(A \cdot f(t) \right) \\
&= 0 \tag{$\ddot{\smile}$}
\end{align}
In the first line I used the product rule and the rule for differentiating matrix exponentials. In the second line, I used the fact that $f' = A \cdot f$ (by assumption).
Now, $(\ddot{\smile})$ says that the derivative of $g$ is always $0$. Hence, (by a corollary of the mean-value inequality) there is a vector $\eta \in \Bbb{R}^n$ such that for all $t \in \Bbb{R}$,
\begin{align}
g(t) = \eta \tag{$*$}
\end{align}
In other words, we have shown that $g$ is a constant function. Multiplying both sides of $(*)$ by $\exp(tA)$ immediately gives us that for all $t$, $f(t) = \exp(tA) \cdot \eta$, which is what we wanted to prove.
If this is unfamiliar, I suggest, you consider the special case $n=1$, so that there are no matrices, and everything is just multiplication by real numbers.
To apply this general result to your specific question, we take $n=2$, and consider the ODE $\xi' = A \xi$, where $A$ is the $2 \times 2$ matrix
\begin{align}
A =
\begin{pmatrix}
0 & 1 \\
-1 & 0
\end{pmatrix}
\end{align}
If you write out the equation $\xi' = A \xi$ in components, we get
\begin{align}
\begin{cases}
\xi_1' &= \xi_2 \\
\xi_2' &= -\xi_1
\end{cases}
\end{align}
Differentiating the first again, and substituting into the second gives us $\xi_1'' = -\xi_1$, which is exactly what you asked (you just wrote $y'' = -y$ instead). It is sometimes helpful to consider a second order ODE as 2 first-order ODE's as I have done.
By what I proved above, we know that every solution to this ODE is of the form $\exp(tA) \cdot \eta$, for some $\eta \in \Bbb{R}^2$. You can verify that the matrix exponential in this case is given by
\begin{align}
\exp
\begin{pmatrix}
0 & t \\
-t & 0
\end{pmatrix} &=
\begin{pmatrix}
\cos t & \sin t \\
-\sin t & \cos t
\end{pmatrix}
\end{align}
Hence, the multiplying out the solution gives
\begin{align}
\begin{pmatrix}
\xi_1(t) \\
\xi_2(t)
\end{pmatrix} &=
\begin{pmatrix}
\cos t & \sin t \\
-\sin t & \cos t
\end{pmatrix} \cdot
\begin{pmatrix}
\eta_1 \\
\eta_2
\end{pmatrix} \\
&=
\begin{pmatrix}
\eta_1 \cos(t) + \eta_2 \sin(t) \\
-\eta_1 \sin(t) + \eta_2 \cos(t)
\end{pmatrix}
\end{align}
Hence, the solution to $y'' = -y$ (which I apologise, but in my notation is $\xi_1'' = -\xi_1$) is given by a linear combination of sines and cosines:
\begin{align}
\xi_1(t) = \eta_1 \cos(t) + \eta_2 \sin(t),
\end{align}
for some $\eta_1,\eta_2 \in \Bbb{R}$.
To learn about matrix exponentials and their properties, and how to compute them, I suggest you take a look at Hirsch and Smale's book "Differential Equations, Dynamical Systems and Linear Algebra".