Hi - basically, the U acts as a trap to hold some water. The water prevents sewer gasses from coming up into the house though the pipes. I'm not a plumber and I may not have stated this totally right, but it's my understanding. Have a great day!
Jim D is right. Not only sewer gas, but anything else that's in the sewer, like insects could come through straight pipes. The "U" holds enough water to act as a seal of sorts. If you were to not use the sink for a long time, the water in the "U" could evaporate, so it doesn't hurt to run a little water in each sink occasionally when they're not in use.