The bread and wine become the body, blood, soul and divinity of our Lord at consecration – the state of the communicant’s soul has nothing to do with it. So you received the Eucharist.
It is a sin to knowingly receive the Eucharist when not in a state of grace, but how would a second-grader know about that unless they were told? My guess is that it’s relatively rare for a second-grader to be in a state of mortal sin, as they would need to not only commit a grave sin, but do so knowingly and willfully. However, it is technically possible, since they are presumed to be at the age of reason, and that’s why one’s first Confession ought to take place before First Communion.
If somehow you were not in a state of grace at the time of your First Communion and received it anyway, that wasn’t your fault. You did not deliberately profane the Body of our Lord by receiving him unworthily. It probably wasn’t even your parents’ fault, as they were likely assuming that the way things were being done was the right way.