It is recommend chimneys be swept at least once a year when burning gas or smokeless fuels, and more frequently when burning wood or coal.
The reason it is recommended to sweep chimneys regularly, is to ensure the soot that builds up in your flue is removed or reduced. If you leave it too long between sweeps soot can build up to such an extent it can become a fire risk or hinder the escape of dangerous gases such as carbon monoxide.
Then of course there is the risk of your chimney becoming blocked by birds, squirrels, bees and wasp nests and even cobwebs can cause a hazard. All can be a fire risk or stop smoke and carbon monoxide escaping through the chimney in the correct manner, leaving only one route of escape back through the mouth of the chimney into your living space.
It is advisable to have your chimney checked by a qualified sweep before you use it each year, and especially important if your chimney has not been used for a number of years. A good chimney sweep will check for cracks in your flue as well as sweeping it.