The Taylor series of #f(x)=cosx# at #x=0# is
#f(x)=sum_{n=0}^infty (-1)^nx^{2n}/{(2n)!}#.
Let us look at some details.
The Taylor series for #f(x)# at #x=a# in general can be found by
#f(x)=sum_{n=0}^infty {f^{(n)}(a)}/{n!}(x-a)^n#
Let us find the Taylor series for #f(x)=cosx# at #x=0#.
By taking the derivatives,
#f(x)=cosx Rightarrow f(0)=cos(0)=1#
#f'(x)=-sinx Rightarrow f'(0)=-sin(0)=0#
#f''(x)=-cosx Rightarrow f''(0)=-cos(0)=-1#
#f'''(x)=sinx Rightarrow f'''(0)=sin(0)=0#
#f^{(4)}(x)=cosx Rightarrow f^{(4)}(0)=cos(0)=1#
Since #f(x)=f^{(4)}(x)#, the cycle of #{1,0,-1,0}# repeats itself.
So, we have the series
#f(x)=1-{x^2}/{2!}+x^4/{4!}-cdots=sum_{n=0}^infty(-1)^n x^{2n}/{(2n)!}#