At 5 months old, your dog is not house trained. Being in the laundry room, likely laying around and sleeping, is much different than up and active. He does not have the mental nor physical capacity to know when he has to go outside yet. It's literally "playing, playing, playing, annnnd I peed!" When you are home with him, you must supervise him 100% of the time. When you can't supervise, crate him or put him in the laundry room. Take him outside frequently, every hour or so. If he has accidents, reduce the time between potty breaks to 30 minutes. Reward him and praise him for going outside.
Dogs really aren't considered fully potty trained until around a year old. Their ability to hold it, even while active, certainly increases the older they get, but they just don't have the ability to turn their brains from something fun like playing and ask to go outside. Also note, some dogs never really learn to tell their owners they need to potty. They might pace or stare at you or look uncomfortable, but that's all the warning you might get. In their own way, they are telling you, but they're just not going and standing by the door. That's why it's up to you to provide potty breaks at regular intervals.