Solar cells are photodetectors but photodetectors are not necessarily solar cells. This also depends on how you define each. But, in general, any device that can detect photons is a photodetector, without regard to whether it makes photon energy available for a circuit. They are designed to have a fast response. Yielding current as quickly as possible, instead of allowing charge accumulation can involve reverse bias (energy spending), and low capacitance, which results in small areas. The structure is also optimized for high sensitivity to certain wavelengths, maybe a single wavelength.
Of course, you can detect photons by converting photon energy into electricity, such as in a solar cell. But solar cells are meant to be power sources, so they work with zero bias, and are specifically optimized to operate efficiently under the broad solar spectrum. Here large areas are preferred to absorb as much light as possible while response time does not matter.
Solar cells typically operate at low voltages and high currents, and photodetectors at high voltages and low currents.
So, is not that they work the same way, they could work under the same principle, such in a silicon diode, but their structure is optimized to meet their different requirements.
A Solar Cell is itself a photodetector. However, a Photodetector may or may not work as a solar cell, which depends on its architecture.
In a Solar cell, our aim is to produce energy from the light (photon to electron). For the current to be generated, initially the incident photons should generate the electrons in the semiconductor (photoexcitation). These generated electrons in the conduction band need to be separated from the holes in the valence band. We require a bias voltage (or electric field) to separate this electrons and holes. Either we can apply a voltage from the external battery to separate or we can generate a built-in field in the solar cell itself. If we use a external battery, then the whole purpose of solar cell is nullified. So we generate a built-in electric field in the device by forming a heterojunction between and p and n-type semiconductors.
So in the Silicon solar cells, we have junction between the p-n type Si, so the built-in potential is generated. This built-in potential separates and transports the electrons to the external circuit, thus giving rise to current in the solar cell. This is how current is generated in solar cell (bit over simplified)
In a photodetector, our aim is to detect light, which means when light is incident on the device, we should see a change in the current (or voltage). So in a photodetector, we can use a external battery (voltage bias) for the separation of electron-hole pairs. This type of detector is called as Photoresistor or photoconductor.
So in a photoconductor, you need not form a heterojunction, a single layer of semiconductor and two pair of metal electrode is enough.
Or instead, if you still want you use a built-in field by forming a junction for the separation, this type of detector is called as photodiode(Same as solar cell).