In the past, people kept cats because the cats hunted and ate mice, rats, and insects. The oldest evidence of cats kept as pets is from the Mediterranean island of Cyprus, around 7500 BC.
Ancient Egyptians worshipped cats as gods, and often mummified them so they could be with their owners "for all of eternity". (They also mummified mice so the cats would have something to eat in the afterlife.) Today, people often keep cats as pets, but there are also cats that live without being cared for by people. These kinds of cats are called "feral cats".
Today, special food for cats is widely available in the developed countries. Proper feeding will make a cat live much longer compared to hunting or being fed table scraps. Not correctly feeding a cat can lead to problems (see below for health concerns).
Cats cannot taste sweet foods (with sugar) because of a mutation (change) in their ancestors which removed the ability to taste sweet things.