Your dog suddenly sleeps under the bed because it might feel safe and secure in enclosed spaces. It may also do this to escape from loud noises or stressful situations. Therefore, it's important to provide appropriate sleeping locations for dogs that are comfortable and safe.