It's really down to two questions: why do electrons interact with photons, and why do atoms absorb photons?
Why interact with photons?
One can understand why electrons interact with photons by considering relativistic quantum field theory. In order to combine quantum mechanics with special relativity, you have to think of reality as consisting of "quantum fields". A field is something that has a value at every location, for example $\Phi(x,t)$ might be a (time-dependent) field, the value of the function signifying the value at every point in space (and every time t). A classical, non-quantum, field simply has a value at every location - you can think of it as the height of some system, say the deviation from equilibrium of an oscillator, at every point in space. A quantum field instead has a quantum system at every point in space; you can think of it as having a quantum harmonic oscillator at every point in space. The state of the point-like system, i.e. the deviation of this oscillator from equilibrium, is the "height" of the field at that point in space.
Now a core principle of quantum mechanics is that the phase of the quantum state does not matter. In order to carry this principle into a quantum field, the equations describing the physics of the system, known as the Lagrangian, has to not change if we change the phases of the states of the points in space. This requirement is known as "gauge symmetry". Now it so happens that it's rather difficult to build a gauge-symmetric Lagrangian using only standard expressions like derivatives. Instead, in order to maintain gauge-symmetry one has to introduce another quantum field, known as the gauge-field. This is the only way to maintain gauge symmetry, i.e. to maintain the requirement that the phase of a quantum state has no physical meaning.
So if you try to build laws of physics (a Lagrangian) to describe a simple matter field (e.g. an electron's field), you need to introduce an additional "gauge" field that interacts with it. The waves in the matter field will be the matter particles, such as electrons. The waves in the gauge field will be force-carrying particles, such as photons.
To summarize then, the reason an electron interacts with photons is that an electron is really a wave in a quantum (relativistic) field, and these waves have to interact with waves in the (gauge) electromagnetic field, which we call photons, in order for the electron's field to be a quantum field (i.e. for the phase of the point-like states to lack any physical meaning).
Why do atoms absorb photons?
Anna v beautifully explained already why an elementary electron cannot absorb a photon - it has to scatter it instead, as the electron's energy and hence mass cannot increase in its rest frame. But why is it that atoms absorb photons?
The important point here is that you cannot turn the electromagnetic interaction "off" for one effect while keeping in "on" for another. If you build an equation describing an electron that's attracted to a positive nucleus by the electromagnetic force, then this same system will also be affected by waves in the electromagnetic field.
So the same equations that describe the stable orbits (the electron levels/orbitals) due to the electromagnetic interaction with the potential energy of the nucleus, also describe a response to an electromagnetic wave (usually dealt with only as a perturbation off the stable state). And this interaction with the waves amounts to annihilating a normal-mode of the wave (annihilating a photon), while at the same time increasing in energy to maintain energy conservation. (Or conversely creating a normal-mode wave while dropping in energy.)