What is it called when you accidentally mix two thoughts with the same meaning and end up saying something with the opposite meaning?

It's called blends, or word blend. There are many different types of blends.

For an example, cool and great coming out as "grool" is an intercalative blend.