Usually, a PS4 will make loud noises if the fan is dirty and dusty.
Another reason it could be loud is because it’s overheating, so make sure you keep it in a well-ventilated area.
A few more reasons could be:
You’re playing graphic-intensive games which overrun the PS4.
Your hard drive is failing.
The cooling fans are running.
There are loose screws within the console.
The heatsink is damaged.