My MacBook Pro (2019) occasionally does this as well. I close the lid in the office, put it in my bag. When I take it out at home it’s turned off due to overheating and the battery is dead. The cause is some background process that’s preventing it going into hibernation when the lid is closed.