Good mutations can be random. Being able to drink milk doesn't have any harmful effects, so it stays. Most of humans are lactose intolerant. 99% of mammals are lactose intolerant. But all mammal infants drink milk. Drinking milk might be beneficial, but it's more likely a random mutation that wasn't selected against since it had no harm and gave a little more calory source to humans.