Here's how it happens:
* Harry, Ron, and Neville are looking for an empty compartment. They are new students and are nervous about starting school.
* They find a compartment with a girl reading a book. This girl is Hermione Granger.
* Hermione is surprised to find out they are wizards. She is very knowledgeable about magic and is excited to be at Hogwarts.
* They start talking and quickly realize they have a lot in common. Hermione is a bit bossy and overbearing, but she's also very smart and helpful.
* They become friends and continue to travel together on the train. They learn more about each other and their backgrounds, and they even manage to help a troll who is attacking a girl named Lavender Brown.
This initial meeting on the Hogwarts Express is the beginning of a lifelong friendship (and some might say, a love triangle) for all three characters.