I'd say, when they are old enough to know the difference between a toy and a tool, between what is on TV or in a game and reality.
When they are old enough to understand what serious injury and death are. Guns are a little more complicated than teaching them the stove is hot, because they can feel the heat (and the danger), so teaching them about guns needs to come a little after that, but not much.
This, of course, will vary with the child.
Children are not stupid, even when they act that way. They just don't understand the relationship between actions and results yet. A five year old can drive your car, because he has watched you do it. But he doesn't yet understand well enough to do it safely.
I know of a four year old who got in the grandfather's LTD, turned the key to "on" (fortunately not all the way to "start", put the gearshift in drive, and steered the car as it rolled. Luckily, he wasn't able to make his first turn, and the car got stuck in some sand.
I know of another, who, at 5 got a .22 rifle from a closet, got the bolt for the rifle from a dresser drawer, and got the shells from a high shelf, assembled, loaded, and fired a single round into the floor! All because of curiosity. That child was not "gunsafed", but had seen it done, and so could do it.
All else being equal (and it almost never is) bigger bullets tend to work better.