https://en.wikipedia.org/wiki/Fourier_series

At definition, they say that an = An*sin() and bn = An*cos()

So with these notations you can go from a sum having sin and cos to a sum having only sin but with initial phases.

Why can I write an = An*sin() and bn = An*cos() ?

It seems out of the blue.