Scienceline answers the question “How do motion-sensing videogame controllers work?” In the case of the Wiimote, it's a combination of accelerometers…
…thinner than a penny, small enough to fit twelve on a postage stamp, and sell for under $6 a piece. They can accurately measure forces more than three times stronger than the pull of gravity in three directions – up and down, side to side, and forward and back. The chips also use gravity to determine the orientation of the controller, whether you’re holding it vertically like a golf club or horizontally like a gun.
…coupled with an infrared sensor placed by the television that determined where on the screen the Wiimote is being pointed.
The article points out that only small motions are necessary to use the Wiimote, but most people like to swing it as if it were a real weapon or sports gear: