These names were thought up about 2,000 years ago. At that time, the Sun was in the direction of the constellation Cancer at the Summer Solstice in June. However, this is no longer true. Earth’s axis wobbles a bit, slowly changing the direction in which it points.
Over 26,000 years, the axis traces out a small cone shape. At this time, the Sun is in Taurus or Gemini (depending on where you draw the boundary between them) at the Summer Solstice. The word "tropic" itself comes from the Greek τροπή (tropi), meaning turn, referring to the fact that the sun appears to "turn back" at the solstices.
|In this chart of the zodiac, the Sun is in the constellation Cancer.|
When the Tropic of Capricorn was named, the Sun was entering the constellation Capricorn at the Winter Solstice in December. In modern times the Sun appears in the constellation Sagittarius during this time.