The normal force is one component of the contact force between two objects, acting perpendicular to their interface.
Friction always acts to oppose any relative motion between surfaces.
For the simple example of a book resting on a flat table, the frictional force is zero. There is no force trying to move the book across the table, so there is no need for a frictional force because there is nothing for the frictional force to oppose. If we try to slide the book across the table, however, friction will come in to play. Let's say it takes a force of 5 N to start the book moving. If we push on the book with a force of less than 5 N, the book won't move, because the frictional force will exactly balance the force we apply.