Clear[T0,k,l]

u0[x_]=4T0/l^2*x(l-x)

u0dotone=Integrate[u0[x],{x,0,l}]

onedotone=Integrate[1,{x,0,l}]

a[0]=u0dotone/onedotone

u0dotcos=Integrate[u0[x]*Cos[n Pi/l x],{x,0,l}]

u0dotcos=Simplify[u0dotcos,Assumptions->Element[n,Integers]]

cosdotcos=Integrate[Cos[n Pi/l x]^2,{x,0,l}]

cosdotcos=Simplify[cosdotcos,Assumptions->Element[n,Integers]]

a[n_]=u0dotcos/cosdotcos

T0=100;
l=1;
Plot[a[0]+Sum[a[n]*Cos[n Pi/l x],{n,1,100}],{x,0,l}]

Clear[T0,l,k];
u[x_,t_,nmax_]:=a[0]+Sum[a[n]*Exp[-(n Pi/l)^2k t]*Cos[n Pi/l x],{n,1,nmax}]

T0=100;
l=1;
k=1;
Plot[u[x,0.00001,100],{x,0,l},PlotRange->{0,120}]

Manipulate[
Plot[u[x,t,20],{x,0,l},PlotRange->{0,120}],
{t,0,0.1}]