As with many other instruments, when it come to learning the keyboard: the earlier, the better!
With the keyboard, however, there is one special feature to consider—especially when starting as a child, it is worth learning to play the classical piano first and then switching to a keyboard. In this way, important basics are memorized early on and children are not overwhelmed with the technical complexity of a keyboard.
Switching to the keyboard is then also easier, because keystrokes and the like are a little easier. Conversely, playing the heavy keys and pedals of an upright or grand piano is often more tedious for learners who are only accustomed to the keyboard. That being said, there is actually no age that is too young for keyboard instruments.
Nevertheless, the following applies: Until the fine motor skills are fully developed and the child understands that they are learning an instrument, the first steps on the instrument are more of a gimmick.
An age between four and six years is often mentioned as the official 'learning age.' By the way, there is a great advantage when learning the piano: Whether you’re young or old, a pressed piano key produces a clear tone, so it can't really sound wrong or crooked. This isn’t the case with string or wind instruments, which can be a bit tiring for the ears at the beginning ;)