At first the thing that comes into our mind is, "The earth is cool - there's no heat in it; it's not warm enough to heat my home!" Although the earth is a lower temperature than we'd like our homes to be, it still has heat in it. Heat normally moves from warmer areas into colder ones, but using the same principle that makes air conditioners and refrigerators work, we can transfer the heat from the cooler earth into your warmer home in the winter.
An air conditioner turns hot air into cold air by removing the heat and pushing it outside. In the summer, the inside air temperature of your home may be 75°F, and the outside air temperature of your home may be 95°F. With an air conditioner, we take heat from the lower inside temperature of your home, and concentrate/condense it into higher temperature heat - higher than the outside air temperature. That makes the heat easy to move into the outside air. An air conditioner/air-source heat pump is thus able to move heat from a lower temperature into a higher one.
Since a heat pump can move heat from any cooler area into a warmer one, we can use it in the winter also: we just turn it around/reverse it, and take heat out of the cooler outside air or earth, and move it into the warmer house.