Why is the middle button mapped to pasting?
The middle mouse button is mapped to paste the current X-selection, which is normally whatever text is selected. This happens because back in the early days of gui's there was disagreement about how copy/paste should work. Some wanted there to be an explicit command to move something into the copy buffer, others wanted whatever was selected to be moved in there automatically. The makers of X11 (way back when these disagreements were still going strong in the 1980's) decided to implement both and make both sides happy, putting mouse-3 to paste the current selection and ctrl-c/ctrl-v for the copy and paste more commonly found today.
As to how to stop it the unfortunate truth is that you cannot without either patching X or disabling the middle-mouse button all together (which can be done by running
xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9"
or by putting the line pointer = 1 25 3 4 5 6 7 8 9
in your ~/.xmodmap
file).
My advice would be stick it out. The X-selection copy functionality is actually quite useful in many places and it is one of those things you quickly get used it.
It predates Ubuntu and Debian, and the design decision in these OSes has been, as far as I can tell, lack of a contrary design to change historical X-Windows behavior.
I realize I'm responding to an old question, but I'm talking about the 80s and 90s, so I think that's fitting.
See also Jeff Atwood's post at Codinghorror.com. (2008, sheesh! Practically yesterday.)
Especially relevant:
In the UNIX and X Windows world, the middle button has also meant paste since way, way back in the 1980s. I can't find any evidence of this behavior on Windows or the Mac, however. Pasting into text areas wouldn't necessarily conflict with the tab behavior, but it's an odd hodgepodge of behaviors to attach to a single button.
Indeed, I pasted that block quote with my ancient and still functioning PS/2 three-button mouse (no scroll-wheel ; a real three-button mouse).
I recently ordered a new-fangled yet old-school 3-button mouse. This one is optical and has a usb connector. Wow. It was about $20 USD, and available from many online vendors.
Behold, the HP DY651A :
I'd say buy one now, so you can enjoy an authentic X-Windows *nix experience before it disappears.