I have a strange fascination with all kinds of autonomous robots. One of the main goals with my math and AI studies is to be able to build my own autonomous vehicle. But that's a few linear algebra courses away… In the mean time, I happily settle for LEGO Mindstorms.
The rotating part is a sensor which detects the distance to nearby obstacles. It looks left and right, left and right, left and right… It then analyzes the best course of action and continues in that direction. If it encounters a dead end it backs up, rotates and tries to find another path.