The term absent-minded professor may address your concept. It is defined by Wikipedia (a questionable authority) as
a talented academic whose focus on academic matters leads them to ignore or forget their surroundings.
It is often used to refer to someone who may be brilliant in some things, but gives an appearance of being scatterbrained.
Another term that is related is idiot savant. American Heritage defines it as
An intellectually disabled person who exhibits extraordinary ability in a highly specialized area, such as mathematics or music.
This literally refers to someone who is actually very limited but has a single high level of skill. It is sometimes used colloquially to refer to someone who is smart but is acting like an idiot.
(It should be moted that the term idiot, along with other archaic terms for developmental disabilities, such as moron and imbecile, are often considered pejorative and offensive in US English.)