So similar in appearance, so similar in etymology (both are derived from the Latin sanguis, “blood”), these words are quite different in meaning, and care must be exercised not to use one when the occasion requires the use of the other.
Sanguine, literally “bloody,” has been used to describe something that was actually bloody or was blood-colored (and is still correctly, though rarely, used in this sense).
From this, it was used to describe a person of ruddy complexion, that is, one of good blood, healthy.
Then it was but a slight change of meaning to apply it, in its present sense, to one who is of hopeful disposition, or confident of success, for these are attributes supposedly borne by one who is healthy.
Sanguinary, also with the literal meaning of “bloody,” is used more with respect to bloodshed, and is properly applied to a person who is bloodthirsty, delighting in carnage, of cruel disposition.