The bladder empties by opening and contracting muscles in response to signals from the brain that it is full. If this nerve/muscle coordination is slow to develop, the bladder can sometimes fill before the child’s brain knows about it. Alternatively, the muscle (valve) could just be too weak.
Children usually sleep more deeply than adults and take longer to fully wake up. This sometimes means they don’t sense the signal telling them to empty their bladder - or else can’t wake up in time.
At night, the body produces a larger amount of anti-diuretic hormone, or ADH. This slows the production of urine, reducing the need to urinate. If, for any reason, it fails to do this, the bladder may overfill.
All of the above conditions usually resolve themselves with time. Anxiety is also often thought to be a cause of bladder weakness in children but there’s little scientific evidence to support this. However, if your child is anxious, it’s important to find out the cause and handle it sensitively.