Hi,
When a dog goes to its bed, that’s often an attempt to reach its ‘safe space’. Any intrusion of that space, when it may already be feeling stressed, is likely to lead to growling, followed possibly by biting. As a general rule, dogs in their beds should be left alone. (My youngest adult DS learnt this the hard way when he bothered our rescue in his bed.)
Your stressed dog has - fortunately- been able to warn you by growling, rather than going straight for the bite. It sounds like your dog is frightened of your child and this isn’t going to end well, as sooner or later he is likely to escalate as growling hasn’t worked.
Rehoming your dog asap, BEFORE he has bitten, will give him the very best chance of getting a more suitable home. It’s not anyone’s fault, but imo, you do need to act now in everyone’s best interests.
Dogs Trust are good to call for advice. Also, if your dog is a specific breed, you could contact a specialist rescue- they are usually very good and it may be possible to rehome your dog straight from your house to minimise the stress for him.
Good luck, and in the meantime, I strongly advise keeping dog and child apart at all times.