These two adjectives have very different meanings.
Sanguinary means bloody, or blood-thirsty (desiring bloody violence), while sanguine means optimistic, confident:
Putin’s sanguinary invasion of Ukraine angered many people. (bloody)
However, many people were sanguine that he would not succeed. (optimistic)
Both words are based on the French word for blood, sang. The meaning of sanguine changed from bloody to optimistic because of beliefs in medieval Western culture about the four humors—four liquids in the human body associated with personality characteristics related to the four elements (earth, air, fire, and water). Blood was related to fire and confidence—and thus the meaning of sanguine.