What are these mathematical groups in U.S. universities? I have just finished my bachelor degree and I will be entering a PhD program in mathematics. On the home page at my schools (and others) I have seen that there are various groups, composed of teachers and students, who study a subfield of mathematics. For example, I have seen "Mathematical Logic" groups, "Mathematical Physics" groups, "Dynamical Systems" groups, etc. What are these groups for? My view of a PhD was like this:

1) You take a couple years of classes and pass your exams.

2) You find a professor and do a thesis.

How are these groups involved here? Are they just for students in the same field to hang out and talk in general about the field?
Mathematical research groups are, as you seem to have surmised, just groups of faculty members and students (i.e., graduate students, postdocs, tenure track and tenured professors) whose research interests all involve some common subfield of mathematics. Thus a number theory group will be composed of number theorists and perhaps faculty members whose main interest is in some other area of math (e.g., combinatorics) but involves number theory in a substantial way. Continuing with the example of a number theory group, at some schools all of the members of the group will be involved in the same flavor of number theory (e.g., the group might be biased towards arithmetic geometry), while at other schools the group might have people representing many different area of number theory (algebraic, analytic, arithmetic geometry, etc).

So what is the purposes of these groups? Well, they're just as much for the faculty members as they are for students. As you mentioned in your post, students in a research group are likely to hang out and talk math with one another. (You'll also be taking a lot of topics classes with the other students in your research group.) The same goes for faculty members. If you're a professor working on a project it's very nice to have someone who works down the hall from you that you can ask fairly technical questions to. (Or perhaps "stupid" questions whose answer you don't know but feel you should.) 

Research groups will also generally have their own weekly seminars. Sometimes these seminars have a lot of talks by the faculty and students at that school, while other times the speakers are primarily visitors from other schools. This gives graduate students the opportunity to see what sort of problems people are working on at the moment and a bit of perspective about the nature of their research area that goes beyond the particular problems that the local professors are studying.