E=mc² so inserting the value of m and c we get 0.511 MeV for electron but then what does this energy account for coz according to me electrons are not made up of any particles so this doesn't account for potential energy neither KE then what does it account for why do a free electron at rest have this energy
I noticed your profile picture is of Albert Einstein. One of Einstein's major contributions is the concept of mass-energy equivalence. It shows that particles have intrinsic energy apart from classically considered mechanical energy. An electron has nonzero rest mass, so it follows that it has nonzero rest energy. Evidence of this can be most easily seen in particle physics, such as electron-positron annihilation.
However, if your question is pertaining to why electrons have mass to begin with, this question pertaining to the Higgs mechanism may interest you: Is the Higgs boson not responsible for most mass?