Nature abhors change. The principle of inertia, one of the most fundamental laws of physics, holds that objects resist changes in their state of motion: If an object is at rest, it will stay at rest until something forces it to budge, and if it's moving, it will keep moving until ground to a halt. That's why spinning makes you dizzy.
In the labyrinthine structure of the inner ear, there are three "semicircular canals" arranged at right angles to one another, so that each senses the movement of your head along a different axis, and all three collaborate to orient you in 3D space. The canals are filled with a fluid that sloshes around as you move. Your ears sense motion by detecting the way tiny strands of hair lining the canals wave back and forth in this moving liquid, like water plants swaying in a river current.
The strands, called hair cells, are suspended in a gelatinous substance called cupula, layered below a fluid called endolymph. When you jerk your head, the endolymph sloshes in one direction or the other through each canal, dragging the slower cupula with it and bending the embedded hair cells to and fro. The information about which way the hair cells are swaying at any given moment gets relayed to the brain via roughly 20,000 nerve fibers, and is interpreted by the brain as movement.
Now, when you spin in a circle, inertia initially causes the endolymph to slosh in the direction opposite to your head's motion. It resists the movement of your head, dragging the cupula backwards with it and thus causing the sensory hairs suspended inside the cupula to bend against the direction in which you're spinning. However, within moments, the endolymph (and thus the more gelatinous cupula) adjust to the movement of your head, and start going with the flow. This causes the hair cells to straighten, and your brain no longer receives the message that you're spinning. Your perception has become normalized to the rotation of your head, giving you the sense that you are still, and the world is rotating around you.
Then, suddenly, you stop!
You have halted the rotation of your semicircular canals. But because of inertia, the endolymph keeps spinning, resisting change yet again. As the fluid continues to move, it once again deflects the cupula — this time in the direction in which you were spinning moments before — and as the oozing cupula bends those hair cells, a signal of movement is transmitted to the brain. You sense that you are moving, but you're not. And that's dizziness.