During Samudra mantha(Sea churning), Lord Shiva drunk all the poison which came out of Manthan. This made His throat blue in color.
From this Source
The poison in the throat is always a burning sensation for lord Shiva. Lord Shiva loves to spend time in meditation (Dhyanam). But this burning throat is not allowing him to do his meditation. Then He ordered Nandi to sit in front of him and blow some air on to his throat. The air blown on to his throat relieves him from the burning sensation. From then Onwards, Lord Shiva does his mediation with the help of Nandi.
Hence, the Nandi statue is place facing opposite to Shiv Ling. The same source also states:
Whenever we visit lord Shiva temple we should not go in between Nandi and Shiv ling (we should not break the path between Shiva and Nandi).If we do so, it is believed that we are disturbing lord Shiva's meditation. If we have a wish to share with lord Shiva, we should tell the wish in the ears of Nandi. Nandi later share the wishes of visitors with Shiva after the meditation.
It is also believed that present of Nandi in Temples shows the Bond between Lord Shiva and Nandi.