idiot savant

a French term for a person who has a mental disability or learning difficulties but is extremely gifted in a particular way, or who (occasionally) displays natural wisdom or insight.