Galileo not only believed but taught and actively practiced astrology, like Ptolemy and Kepler before him. His primary source might have been Porphyry’s commentary on Ptolemy's Tetrabiblos. In particular, he constructed and interpreted horoscopes, including ones for himself and his daughters that are extant. His discovery of the moons of Jupiter was followed by making a 1610 horoscope of Cosimo de Medici, where Jupiter is prominently featured. Astrology was taken as a matter of course at the time, so believing it carried no more weight than believing that the Sun goes around the Earth by someone never forced to confront contrary evidence or consider alternatives, and going about their everyday business on that assumption.
The subject was intertwined with what we now call astronomy, and taught at top universities by mathematici like Galileo. Ironically, the Church was on the opposite side on this one, as it opposed "fatalistic" interpretations of astrological predictions. Galileo was investigated for practicing "fatalistic astrology" by the Inquisition in 1604, but the charges were dropped. The seeds of modern skepticism about astrology only emerged in the later part of 17th century, after Galileo's death.
Galileo's practice was long overlooked and/or misinterpreted by earlier historians, which is also reflected in the more literary works like Brecht's play Galileo and Koestler's Sleepwalkers, which anticipated some themes from Kuhn's Scientific Revolutions. For a comprehensive review of primary sources and commentary see Galileo’s Astrology volume (2003). Here is from Rutkin's review Galileo as Practising Astrologer of Ernst's critical edition (2017) of Galileo's astrological manuscript no.81, that was only recently made available to scholars in full:
"It contains horoscopes for 19 people (some with two slightly different
figures) in Galileo’s own hand and was gathered together into one manuscript from
originally separated folia. Although it has been known for over a century (since 1881
when Antonio Favaro wrote about it in a very brief article) and although its attribution
has never been seriously challenged, MS Gal. 81 and the essentially normal astrological
practices that it reveals have not yet been taken fully into account in the literature seeking
to understand and assess Galileo’s life and works, and it has never been published in its
entirety...
While teaching at the University of Padua, Galileo practised astrology by constructing
and interpreting horoscopes for a range of patrons, students and family members,
seeking, among other things, to raise extra money as we can see in his contemporary
account books for payments made to him “per sortem.” This evidence dates some of
these horoscopes to 1603, that is, soon after the death of one of his early patrons, Gian
Vincenzo Pinelli (1535–1601)...
We possess other evidence for Galileo’s astrological practice around this time, including
his first investigation by the Venetian Inquisition in 1604, following the official
denunciation made by his former amenuensis, Silvestro Pagnoni from Pesaro, who had
accused Galileo of practising a deterministic astrology. We know about this revealing
incident in some detail from Antonino Poppi’s valuable researches, including that the
case was dropped because Galileo was practising normal, not deterministic astrology. As
we now know without any doubt, throughout the 16th and well into the 17th century
astrology was still taught at the finest Italian universities, including at both Padua and
Bologna, and was a normal part of the study, practice and teaching of an early modern
“mathematicus.”...
In addition to setting out all of the astronomical and astrological data as well as the
numerical calculations used in MS 81 for erecting and interpreting these horoscopes,
perhaps the most valuable feature of Ernst’s edition is the transcription of Galileo’s astrological
interpretations, which were all written in Latin in the five horoscopes that include
them, some of which are very difficult to read in the manuscript. These interpretations
are very interesting, in that we can thereby catch a glimpse of Galileo doing the normal
work of both casting and interpreting horoscopes... The construction
of his own horoscope (in two variant versions, but without an interpretation) and those
for his two daughters (with their interpretations), as well as for other family members,
belie assertions claiming that Galileo himself personally rejected astrology or that he
only used it cynically for patronage purposes."