The answer depends on your situation.
For large projects - and established plants - pipe specifications are created. The specifications include a section for each pipe class used in the project or plant. For example: a section is devoted to pipe for low pressure steam, another for compressed air up to 150 psig, etc. Each section spells out its scope, including the fluids it is used for, pressure limit and temperature limit. Shortcut nomenclature is usually used to refer to a section, such as "A1". The process engineer uses this nomenclature when creating the P&ID, incorporating it within the line number, which then ties the pipe specification to the P&ID.
The pipe specification includes, for each pipe size in its scope, the wall thickness. For instance, a typical specification will call out:
Pipe: 1/2" to 2" Schedule 80, 3" to 8" Schedule 40, etc. (followed by materials of construction, end connections, and everything else needed to get the exactly correct pipe to the job site). Other portions of the section cover fittings, valves, bolts, supports, branch connections, etc.
Your question is who determines the pipe schedule. For the project / plant specification case, this is generally done on an institutional basis meaning that the specifications are well established and proven over time. The project or plant standardizes on the specification to minimize the chance of mix-up, reduce spare parts inventory and reap the normal benefits of standardization. The original determination is most likely done by a piping or mechanical engineer taking into account the service conditions, selected piping material (and its yield stress), supporting span, possibility of the pipe being used to support other pipes or components, possibility of the pipe being subjected to external forces (people walking or stepping on the pipe, for example) and, of course, cost.
For isolated projects where there is no plant or project specification already established, it's likely that the project team is limited. You would use your best resource to write the specification and it is not unusual for the process engineer to specify the pipe schedule.