How does a wire carry alternating current? Consider a simple network of a bulb whose two terminals are connected to two wires with open ends A and B respectively
 A o----------------o B

Now if a DC current source is attached across A and B, say terminal B is at +5 potential and terminal A is at 0 potential, then exactly what happens is that "negative charge flows to terminal at higher potential, i.e. terminal B" and what that means, as I understand it, is that : -
Because of electromagnetic forces,  all of the electrons in the wire are displaced towards A with a certain velocity causing a positive current towards B. This drift of electrons heats up the highly resistive filament wire in the bulb and makes it glow. 
So something like the following is a good representation of the journey of a single electron e in the wire for a DC circuit: 
 A o-------------e--o B  (+5)
 A o-----------e----o B  
 A o---------e------o B  
 A o-------e--------o B  
 A o-----e----------o B  
 A o---e------------o B  
 A o-e--------------o B  

Assuming that my understanding of how a wire carries DC current is correct, I would like to understand how a wire carries alternating current.
I think that since AC current periodically changes direction, maybe the electrons move back and forth, (maybe oscillate along the length of the wire about their mean position?), which will also warm up the filament of the bulb and thus light it up. But I don't understand why they are able to move back and forth. Especially if the length of the wire was large, say 3 * 10^8 meters, then would the movement of electrons on one end of the wire be "in sync" with the movement of electrons on the other end?
Bonus question: how would the electron flow in DC circuits work if a bulb and a 5V voltage source kept 3*10^8 meters apart were connected by two straight 3*10^8 meter long wires? Assume that there's a switch halfway between one of the two wires and it has just been flicked to the "on" position.
 A: 
Specially if length of the wire was large, say 3 * 10^8 meters, then
  would the movement of electrons on one end of the wire be "in sync"
  with movement of electrons on the other end?

No, they wouldn't and this fact is crucial for understanding antenna operation.
Note that even short conductors become electrically long if the frequency is high enough.
Essentially, if the length of the conductor is very small compared to the wavelength of an EM wave at the operating frequency, then the voltage and current along the wire at any instant of time is essentially uniform, i.e., we can treat the conductor as a lumped element.
However, for conductor lengths comparable (or much longer) to the wavelength, the voltage and current along the conductor will vary in space and time.  For example, look at this distribution, at one instant of time, of the voltage and current along an antenna:


Bonus question: how would the electron flow in DC circuits work if a
  bulb and a 5V voltage source kept 3*10^8 meters apart were connected
  by two straight 3*10^8 meter long wires? Assume that there's a switch
  halfway between one of the two wires and it has just been flicked to
  the "on" position.

This is not too far from a standard problem when studying transmission line theory.
Essentially, the two wires form a guide for electromagnetic waves and have an associated characteristic impedance.  You might, for example, think of your two conductors as something like 300 Ohm twin lead transmission line.
A transient analysis of a switched transmission line problem will give solutions that look like propagating step functions of voltage and current that involve reflection at the ends (due to impedance mismatch) and dissipation.  Eventually, the system settles into steady state.

A: 
Because of electromagnetic forces, all of the electrons in the wire are displaced towards A with a certain velocity causing a positive current towards B.

The electrons have a small drift velocity, not moving much. 

Although your light turns on very quickly when you flip the switch, and you find it impossible to flip off the light and get in bed before the room goes dark, the actual drift velocity of electrons through copper wires is very slow. It is the change or "signal" which propagates along wires at essentially the speed of light. 

A single electron does not go from A to B. Think of it as each electron pushing the next one, and the signal travels with the velocity of light ,maximum, down the wire.

This drift of electrons heats up the highly resistive filament wire in the bulb and makes it glow. 

True.

But I don't understand why they are able to move back and forth. Specially if length of the wire was large, say 3 * 10^8 meters, then would the movement of electrons on one end of the wire be "in sync" with movement of electrons on the other end?

Why not? When the field changes at A and B the change propagates by electrons moving back and forth over an average position. Similar to water waves, the atoms do not move much from their position, the energy is transferred atom by atom. In the case of electric fields and electrons the field is built up at the microscopic scale by the motion in situ of the electrons, in a sinusoidal way.
Very long wires enter the realm of special relativity and the limit of the velocity of light in transferring effects of fields.
A: As the other answers point out, there are a vast number of electrons in a piece of wire, and no single electron must traverse the whole circuit for a current to flow. You can think of an ac current as more of a sea of electrons sloshing back and forth. 
I'll focus on your second question: 

How would the electron flow in DC circuits work if a bulb and a 5V voltage source kept 3*10^8 meters apart were connected by two straight 3*10^8 meter long wires? Assume that there's a switch halfway between one of the two wires and it has just been flicked to the "on" position.

When the length of the wires gets longer than about 1/10th the wavelength corresponding to the frequencies in the current signal, you need to start thinking of your wires as transmission lines instead of ideal wires. 
That means that you must consider that no signal propagates faster than the speed of light, and likely even slower to account for the geometry of the line and the dielectric effect of the medium between the two wires.
For the kind of situation you're asking about, the critical distance will be much less than the $10^8$ m you mentioned. For 60 Hz ac transmission, this distance would be only a 100 km or so. If you really had a fast closing switch and a high speed light source (like a laser diode) as the load, you might see transmission line effects with only a few cm between the switch and the load.
The basic result is that when you close a switch on a long line, the current signal will only propagate toward the load at about c. And when it reaches the load there will most likely be a reflected signal generated back toward the source, causing a "ring" in the signal. The details of what the propagating signal looks like depend on the details of the line geometry and the material between the signal and return lines.
A: It is due to the electric field that is set up that will cause the electrons to move. The drift velocity of the electrons is much slower. There will be a delay in switching on the bulb, and it is equal to approximately $l/c$, $l$ being the length of the wire. Your diagram is not exactly right, as it shows as if the electrons are being produced at one end and being received by another, electrons will always be present (in abundance), so the end electron and the start election will be out of sync by $l/c$, the same works for AC and DC.
A: Think of AC as something that starts out as a positive DC voltage. Then it starts going in the opposite direction. Then back again. And continues doing that over and over. Then smooth the current change out and make it sinusoidal. Now you have AC.
