How are there different types of apples?

there are many different types of apples, the same as different types of pears, grapes and many varieties of vegetables.