Given: The speed of light in space is a constant; it does not vary (proven).
Given: Time near a large mass (e.g. Earth) is slower than time further away from a large mass (proven).
Given: velocity = distance traveled / measured time.
Therefore distance traveled by light must be different with a difference in measured time.
This alteration of the "metric" of space as well as time (call it space-time) is what causes GRAVITY.
The "metric" can be thought of as a 3-dimensional grid overlying the empty nothingness of space. This grid is the measure of distance in space.
Mass causes this alteration of space-time somehow, and is affected by it (gravity).
Mass wants to move to where time is slower and the "metric" of space is smaller.
A clock on a GPS satellite is about 500 picoseconds faster per second than a clock on Earth (the Special Relativity effect of the satellite's velocity through space is removed from this time). That's 1/50,000,000,000th of a second. The speed of light is about 300,000 meters per second. So the linear change in the "metric" of space on Earth will be about 300,000/50,000,000,000 of the linear distance of the "metric" of space at the GPS satellite orbit or 3/500,000 meters or 0.000006 meters smaller. See Time Dilation/Gravitational Time Dilation on Wikipedia.
Electromagnetic waves (photons) bend closer to a large mass as they travel through space because they have energy, and Einstein's General Theory of Relativity equation includes energy in its stress-energy-momentum tensor. The General Theory of Relativity explains how space-time causes gravity in extremely complex mathematical terms. Einstein used the term space-time because he combined the 3 dimensions of space with time to come up with his mathematical equation. Since he characterized space-time as 4-dimensional, he said that space-time "curves" more nearer a large mass. This is equivalent to saying the "metric" of space get smaller while time slows near a large mass. Both are correct.
Astronomer Edwin Hubble famously postulated in 1929 that only the continuing expansion of [the "metric" of] space could account for the fact that the further that light had to travel from distant stars/galaxies, the greater the red-shift of light (Hubble's Law). Red-shift refers to the fact that even though light always travels at a constant speed in space, its energy (measured by its wavelength or frequency) decreases as the "metric" of space expands. It's also true that light is red-shifted as it travels away from a large mass (like Earth), or blue-shifted as it travels closer to a large mass.
You can visualize light being red-shifted with space expansion by imagining a string in the form of a sine wave beginning at point A and ending at point B. If you move point B further from point A (the "metric" of space expanding), the sine wave will have a longer wavelength, which, if the sine wave represented a color, would change in the direction of the red end of the color spectrum.
Astrophysicists don't like to guess at what caused the Big Bang and Inflation (see Inflation (cosmology) in Wikipedia), but the General Theory of Relativity would explain what happened after the Big Bang. They say The Big Bang started with a "singularity", and that there was no "metric" of space or time just before the Big Bang. This sounds like a black hole containing all the universe's mass. If this "singularity" exploded into pure energy (the Big Bang), then the sudden absence of mass would cause the "metric" of space to expand and time to increase from zero, carrying all that pure energy with it. How fast it expanded wouldn't matter as long as space and time changed together so as to keep the speed of light constant. This explains how Inflation seemed to greatly exceed the speed of light. You can visualize this Expansion as the inside of a balloon as you blow air into it (and imagining time also speeding up in it). As the pure energy cooled, it began converting to basic atomic particles everywhere (see Cosmic Microwave Background in Wikipedia), which began slowing the expansion and eventually combining into simple atoms like hydrogen and helium, which eventually combined into stars, etc, due to "gravity". Space-time would still be expanding, but at a slower rate due to the increasing existence of new mass. It's been shown to have stopped expanding near a large enough amount of mass, like a dense galaxy. The expansion of space seems to be increasing again, though, and this could be caused by an unknown force (dark energy), but it would also be at least partly caused by the density of the mass in our universe decreasing as the "metric" of space increases.
Magnetism is very similar to gravity, but it needs a moving electrical charge, along with the Theory of Special Relativity, to exist (electrical charges travel VERY fast). Special Relativity says that when two observers see each other when their passing speed is near the speed of light, then they will both see the other as contracted in the direction of motion. This relativistic effect causes electrons moving in the same direction to see more protons than electrons in the other wire than they would see if they weren't moving, and fewer protons than electrons in the other wire if the electrons were moving in the opposite direction. Permanent magnets exist because all the electrons in a permanent magnet are oriented in the same direction, i.e. their electrical charges are all "spinning" in the same direction (VERY fast). I quotize spinning because physicists use the term spin in a different way. So magnetism is simply the name given to how VERY fast moving or "spinning" electrons along with the Special Theory of Relativity affect other electrons.