Using ubuntu as an example.
Ubuntu is a distribution which packs a lot of software together, small and large. There are graphic drivers, the x server, and gnome, among others. Ubuntu itself is not developing those software. Ubuntu is "just" packing the software together, making sure that the individual components work together. All that software which ubuntu is packing together are called upstream from ubuntu's point of view.
In the process of combining all that software together bugs might pop up. The bug might be in one of the software components, for example gnome, or it might be in the very special way ubuntu is doing things. After all, a distribution is a distribution because it does some things in it's own very special way.
If the bug is caused by the way ubuntu is doing things, then ubuntu will have to fix that bug for itself. If the bug is in fact in one of the software components, for example gnome, then ubuntu will have to patch gnome. When ubuntu sends the patch back to gnome, so others can also benefit from the patch, then ubuntu is sending that patch upstream.
If ubuntu decides to not send that patch upstream, or the upstream project rejects the patch, then ubuntu has technically forked the project.
The opposite of upstream would be downstream, ubuntu is downstream from gnome. I do not hear/read that term used often.
See also the article about upstream in wikipedia.