I drink a lot of tea, so caffeine consumption has always been something the kids are familiar with. I occasionally used to let them have a sip of mine when they were much younger but only recently started giving them their own to drink (probably around age 7/8). When they do ask for a cup of tea I only give them half a cup of weak, milky tea, so they're not getting huge amounts of caffeine, and they don't drink it more than about once a week on average. I still don't give them caffeinated fizzy drinks although if I found out that someone else had given them a coke I wouldn't be too worried (unless this was happening very regularly). I have told them that caffeine is not really very healthy and it's best for kids not to have much as their bodies and minds are still developing, and that grown ups can choose to make unhealthy choices because as an adult you are responsible for your own wellbeing and can choose whether you want to accept the consequences, but as their parent it's my job to protect them. Very similar in some ways to how I have explained about alcohol and other things, in fact.
We have to be realistic in admitting to children that people do things that are bad for them, as they will see people all around them doing things they shouldn't do, but do our best to explain why they should avoid doing these things themselves and help them to make educated choices as they get older. I have tried to explain to them that one of the reasons it is especially important for children not to use caffeine, alcohol, drugs, etc, is that they are still developing and these things can interfere with that. Hopefully the fact that I have taught them this now will make it easier for me to have similar discussions about drugs & alcohol in their teens - personally I don't have a moral concern about these things, but knowing what I do about brain development makes me concerned about young people getting into them too early while their minds are not yet developed. And from a behavioural point of view, it's easy to get into "bad habits" with these things at a young age and once habits are established they can be hard to break. For example, a lot of teenagers binge drink, and this then becomes the norm so they continue doing the same as adults. If every time you've been out drinking you've always got very drunk it feels weird to go out and drink more sensibly! I know my tea drinking is a pattern that was established at a young age - my parents allowed me to drink tea & coffee when I was a preschooler, and it became a normal drink for me. I now find it really hard to wake up in the morning without several cups of tea! I also experienced insomnia for most of my school years and it was only when I was an older teen that I cut down the amount of caffeine I drank in the evening & started to sleep more normally. The effects of caffeine definitely shouldn't be taken lightly!
I have explained all of this in a child friendly way - my kids understand that it is good to avoid getting into bad habits as they are hard to break, and that their brains & bodies are precious things that they should protect from harm (especially while still developing), and that thinking about the consequences of their actions, even very far into the future, is important, and so on. I think helping them understand these things gives them the tools to make better decisions in their lives, and are much more useful than blanket, black & white "do this, don't do that" statements (I do also tell them when I feel they should or shouldn't do something, but always try to explain why, not just "do as I say"). However, even if you have given them these tools, children naturally live in the present and are not good at thinking through the consequences of their actions, so until they develop this skill fully it is our job as parents to help them avoid serious negative consequences & guide them towards sensible decisions.