You could be walking around in tall grass and a wild battle spontaneously occurs, you could walk in front of (or talk to) a trainer and enter a battle against them, or a battle could be scripted to happen when something occurs (such as interacting with something in the overworld).