Electric potential is primarily generated by the movement of ions across cellular membranes through specialized channels and pumps. These ion channels and pumps create a difference in ion concentration between the inside and outside of the cell, leading to a voltage difference. This phenomenon is crucial in the functioning of excitable cells like neurons and muscle cells.