Dear student
The electronic configuration of Be is 1s22s2
and that of C is 1s22s22p2
In the case of Be there are no unpaired electrons as both the s orbitals have paired electrons. Whereas in the case of C, there are two unpaired electrons in each p orbital and thus it is paramagnetic.
Regards