Hewlett-Packard Co. announced plans to keep its personal-computer unit, marking the first major decision by Chief Executive Officer Meg Whitman since taking over last month.