Who writes functional specification in a software company ? Given a software company typically comprises of Software Engineers, Engineering Managers, Product managers and Directors?
If it is a you-ask-we-write kind of company, the client does.
If it is a company that thinks it has a great idea and intends to just create something and then try to convince potential clients to buy their product, it may be the entrepeneur himself.
Most often though no one does. Someone just thinks out loud for a moment and another one starts coding.