In this paper, using the similarity between quantum tunnels in nanostructures and BIon in M-theory, we propose a new model which considers the process of formation of superconductors in nanostructures. We show that by decreasing the size of nanostructures, emitted photons by electrons connect to each other and form a wormhole-like tunnel. This tunnel is a channel for transporting electron inside the nanostructure. If different wormholelike tunnels join to each other, one big tunnel is constructed that can be an origin for superconductivity in matter. The superconductor order parameter depends on the size of nanostructure and temperature. Increasing temperature, it is shown that the model matches with quantum theory prescriptions. Also, by applying external electromagnetism, external photons interact with exchanging photons between electrons, exchanging photons deviate from original route and the formation of wormhole-like tunnels inside a nanostructure is prevented. Finally, it is shown that the origin of electrodynamics and gravity are the same and thus, the phrase of wormhole can be applied for appeared tunnels in nanostructures.