I learned at age 4-5. I had a boy and a girl cousin that were my age, a year younger then me, the boy age 3. We would all play together, and sleepover, etc. I always wanted to play with my girl cousin and with easybake oven, barbers, play dress up in girls clothes, etc. I didn't think I was doing anything wrong, just what I liked and made me feel good.
My dad caught me playing with dolls and baby strollers, etc., and then shamed me, and told me I was a boy and should play with the hot wheels and G.I. joe with my boy cousin. I remember this very well, because he made me feel really bad and ashamed and I couldn't understand why. I still played with my girl cousin and clothes, I just was more careful not to let my dad catch me.