I've read several papers that mention that there are specific neurons that are activated for specific things (e.g. neuron A activate only when horizontal lines appear, neuron B activate when certain sound appear, etc). How does this happen over time (unless the neurons are "born" with certain "affection" towards stimuli) and what is the mechanism that allow it? I understand that it's probably not some conformational change in proteins since the activity has to be really fast- so how can an electrical signal be selective?
Sensory receptors and neurons get their selectivity from physical processes and their position in space. For example, photoreceptor cells in the retina respond to light in a specific position in space because the lens and structure of the eye directs light incoming in a particular angle to a specific spot on the retina. Sensory receptors in the skin can sense touch in a particular place because that's where they are located. Hair cells in the cochlea respond to particular frequencies of sound because the membranes in the inner ear vibrate at different frequencies along the length.
The "LGN" (visual thalamus) cells pictured here have receptive fields that look a lot like the retinal ganglion cells that carry output from the retina. For simplicity, you can think like they are the same. These cells are excited by light in the center (red), and inhibited (indirectly) by their neighbors (blue) (there are also "off-center" cells that respond in the opposite way, preferring dark in the center and light in the surround).
If you add up a bunch in a row, you can make a cell in primary visual cortex (V1, the green cell) that responds to edges. If you summed up the receptive fields of cells in a different orientation you'd get selectivity to a different orientation of lines. The key feature to making selective receptive fields is which cells are connected to which.
These receptive fields are created in development by spontaneous activity in the retina and eventually by actual visual input when the eyes open. The process is pretty complex and occurs in multiple stages, but you can start with a review like this one:
Higher in the visual processing hierarchy you will find increasing complexity as receptive fields of different types are combined and recombined.