Both 太陽 "taiyou" and 日"hi" mean "sun" in Japanese. However, 日 is a more anthropocentric term, meaning it refers to the sun as something in relation to human activities. If you're talking about the sun setting or rising, then 日 is the proper word to be used.
太陽, on the other hand, is used to refer to the sun as a body in the solar system. It is more scientific than 日. Thus, we have the words
taiyou no kokuten
taiyou no chokkei
diameter of the sun
I've also seen 太陽 used in songs:
koishiteru chikara ni mahou wo kakete, taiyou ga zutto shizumanai you ni
Put a spell on loving power so that the sun wouldn't set.
Hora taiyou ga, yasashii kaze ga, bokura wo mitsumete iru kara
Look, the sun and the gentle wind are gazing at us.
In these two examples, the sun seems to be considered as an animate object, almost like personification.
Akira Miura, Essential Japanese Vocabulary, Tuttle Publishing.