If you act immature or bratty, you're being childish. A childish dinner guest might pout because you didn't make dessert.
While the adjective childish is sometimes used to simply mean "like a child," it's more common to use childlike in this way. When your teacher comments that your chattering during class is childish behavior, she means that you're acting as juvenile as a four year old child. This negative implication has been attached to childish since the 15th century. The word comes from the Old English cildisc, "proper to a child."