Technically, all fiction is fantasy, so every type of fiction is a subgenre.
Exactly so. Much popular fiction is mimetic of reality to a greater degree than science fiction.
That said, science fiction is simply a subgenre of fantasy employing certain tropes and themes. What most people are aware of as sf evolved as popular fantasy in the first half of the twentieth century.
Indeed, Thomas M. Disch went further and was more specific in consigning most commercial science fiction to the realm of children's literature. When you understand his point it's hard to argue with him.
The notion that stories about other planets, nonexistent machines that do miraculous things, time travel, etc are something other than fantasy - with a few storytelling "rules" sometimes applied, sometimes honored in the breach - is silly and a nonstarter.
The only respect in which science fiction is distinct from fantasy is for purposes of consumer labeling - this one's got a spaceship on the cover; vampires and dragons over there.