A gyroscope balances due to the principles of angular momentum and precession. When it spins, it has angular momentum, which resists changes to its orientation. If an external force is applied, the gyroscope responds by precessing, moving in a direction perpendicular to the force. The faster it spins, the more stable it becomes, maintaining its balance.
Check out www.uknowhat.org to buy this cool toy. (Link in Bio)