Obviously, some monsters make more sense than others. A Mimic might actually be the treasure chest you thought you were opening and a monster attack is imminent; otherwise, a monster may simply live near the area surrounding the chest and is fighting to defend its territory. If the monster is humanoid, it may be trying to claim the treasure for itself at the same time as you.

I hope that these types of gameplay mechanics would be more fully realized and explained in later games.