After much research, I found a posted answer that does not depend on such arbitrary facts as assuming Hooke's law is true.
Suppose Energy(E) as a continuous function of displacement (y)
$$\color{blue}{E = f(y)}$$
Using Taylor Series for a continuous function we have (where $\color{blue}{'}$ represent a derivative)
$$\color{blue}{E(y) = E(0) + E\,'(0)y + \frac{E\,''(0)y^2}{2\,!} + \frac{E\,'''(0)y^3}{3\,!} + ...}$$
$\color{blue}{E(0)}$ is a constant which depends on reference. It can be considered as $\color{blue}{0}$ and selected as, for instance, the position of the tip of a stretched spring, when the movement changes direction. This is a characteristic of any type of oscillatory movement.
$\color{blue}{E\,'(0)}$ is $\color{blue}{0}$. Reversing the direction of motion in a continuous function means that the first derivative is null in the reference point. Non-oscillatory movements are not included in that reasoning.
$\color{blue}{E\,''(0)}$ as a constant $\color{blue}{k}$, since it is the value of a function at a given point.
$\color{blue}{E\,'''(0)}$ and so on can be dismissed in simpler models.
So
$$\color{blue}{E(y) = \frac{k\,y^2}{2}}$$
This is the formula of the potential energy
of a spring, when someone pull a spring and hold it. Now we can derive it in relation to x
(Energy = Force * Distance):
$$\color{blue}{E\,'(y) = F = -ky}$$
As the force acts for something to return to a stable position, the constant $k$ shoud be preceded by a -
signal.
The above expression can be expressed as a function of the acceleration, 2nd. derivative of displacement function, when expressed as a function of time t
(m
is mass).
$$\color{blue}{ m\,y\,''(t) = -k\,y(t)}$$
The most general solution of the above differential equation where the second derivative is the function itself, with the changed signal corresponds to:
$$\color{blue}{y(t) = A\,sin(\omega t + \Phi)}$$ $$\mathsf{or}$$ $$\color{blue}{y(t) = A\,cos(\omega t + \Phi)}$$ $$\mathsf{or}$$ $$\color{blue}{y(t) = A\,sin(\omega t) +B\,cos(\omega t)}$$
Where amplitude is maximum value ($\color{blue}{A}$ in the first two, and $\color{blue}{\sqrt{A^2+B^2}}$ in the third ) , $\color{blue}{\Phi}$ is phase and it is shown easily that $\color{blue}{\omega = 2\pi/T}$ ($\color{blue}{T}$ is the period, time for a full lap).
There are 2 different constants because are 2 freedom degrees in double derivation.
For instance, if one derives the first solution twice, one gets
$$\color{blue}{y''(t) = -A\,\omega^2 cos(\omega t)}$$
That can be rewritten as
$$\color{blue}{y''(t) = -\omega^2 y(t)}$$
So
$$\color{blue}{\omega = \sqrt { k/m}}$$
Remembering that it is indifferent to use sine
or cosine
because
$$\color{blue}{sin(y+\pi /2) = cos(y)}$$
Let's forget the other 2 solutions and let's focus on the first solution ($\color{blue}{\sin}$)
To visualize better, if we imagine this function as expressing the vertical oscillation of an longitudinal oscillatory motion. Let's consider
$\color{blue}{\Phi = 0}$ so $\color{blue}{y(t) = A\,sin(\omega t)}$.
It's possible interpret the $\color{blue}{y}$ value as $\color{blue}{\sin}$ value in a uniform circular motion in a circle of radius $\color{blue}{A}$, see in a profile view, as the eye in the below figure:

Any above expression represents simple harmonic motion (SHM), that can be displayed as circular movement with constant angular speed. Over time, the amplitude draws a sine
graphics.
Most oscillating system will behave like a vibrating spring, so long as the oscillations are small enough. For this reason, the vibrating spring, or simple harmonic oscillator (SHO) as it is called is very important in Physics.