Welcome to Fluther.
Here is a relatively simple isometric / cross-sectional drawing of a chimney. As you can see from the diagram, chimneys are not quite as simple as they appear to those who don’t understand them. They’re not just a collection of brick and mortar that the homeowner hopes is more or less plumb.
The interior surface of the chimney, the flue, is lined with a heat-resistant material (more heat-resistant than masonry brick, that is) which will stand up to the hot and often corrosive environment of the combustion gases, as well as to the regular brushing that may be required to maintain the flue for some fuels, notably wood. That, in essence, is the chimney liner.
In modern chimneys, the brick is primarily a structural material that will withstand some heat, and the liner is the material that provides the flue for the exhaust gases and protection for the interior of the chimney itself from those gases.