Both an internist doctor and an MD doctor are primary physicians but an internist doctor is sorta like a pediatrician for adults.
That means that Internist care for adults only while an MD can be both a Pediatrician and an adult doctor at the same time and care for both children and adults.
The main difference between Family Medicine and Internal Medicine is that IM training focuses on adults, with residents spending time between various adult medicine sub specialties.