How does freelancing relate to consulting?
Consulting implies a more advisory role while freelancing implies you are working on something.
Another similar term is contracting. The implication of contracting is that you only work on one project at a time. Often enough at the company's office as well. Contracting is more like a temporary work situation.
'Creative' industries like web design and development have a tendency to use freelancing. While consulting or contracting would almost always be used when developing a java program for a bank.