How did people realize they could do logic with electronics? Are there anecdotes of the first realizations? I'm wondering about the first "eureka" moments.
I think the resources listed above are good background references but if you want to know how logic was introduced to actual electronic equipment then consider Claude Shannon. At the age of 21, writing his MIT Master's degree thesis, he laid out the methods of how electrical applications of Boolean logic can carry out any logical or numerical process.
This was in the year 1937 and although it is not the start of work on computing devices or unique, Shannon, more than any other single person, is responsible for answering your question.
Claude Shannon is considered the father of Information Theory and also wrote many papers on the entropy of information and using statistical methods that were not that different from statistical physics (e.g. Boltzmann Distribution).
Also, a small extra -- Shannon wrote at least two papers on algorithms for a chess playing computer implementation. I wrote a chess playing program back in the late 1960s and early 1970s when I completed all my work on it. Most of my motivation came from Shannon's papers which I still have in some binder someplace.