Google revealed on Monday that it will buy handset maker Motorola Mobility, giving the search giant an entrance into the hardware business and allowing it to compete with Apple more directly by building devices tailored specifically for its Android mobile operating system.