A pergola has a flat roof, creating an outdoor room with partial shade. You may choose to grow vines on it, which would provide deeper shade for the summer months.
A pavilion, on the other hand, has a roof. It can extend your backyard season with its more protected space. A larger pavilion could be the frame for a small cottage or other building.