Error is not always Wrongdoing
The OP writes of "wrongdoings of algorithms". To me a "wrongdoing" is something that would be criminal, or at least involve civil liability. But not every time that something goes wrong is there any "wrongdoing" in this sense. Sometimes a bad outcome is simply an accident, and no one is liable, civilly or criminally.
That said, no algorithm today is, to the best of my understanding, anywhere near the point where we can speak of the wrongdoing of an algorithm. Algorithms make errors, people do wrong. If there is liability when an error results in damage, in may be the responsibility of the maker of the algorithm, or of some individual who worked on the algorithm, or of the user who was running the algorithm, or perhaps of some other person who was in some way involved. Determining which is one thing that the legal system must do, and it isn't always easy.
In many ways this is simply the problem of liability for the failure of a manufactured product, and is no different just because an algorithm or an AI is involved, although the situation may be more complex.
The OP writes in the question:
isn't it obvious that it's the company who developed the algorithm that is liable for any issues that this algorithm caused?
The law could take that approach, but in many cases it would work injustice. So it doesn't take that approach, at least not in the US or the UK, and I don't think it does in any current jurisdiction.
Let's consider a simple case, with a manufactured product but no algorithm at all. A carpenter is using a hammer to nail boards to studs in the framing of a house. S/he lifts the hammer back, and the head comes loose, flies away, and hits another worker in the head, injuring or killing that worker. Is the manufacturer of the hammer liable?
Possibly. If the making of the hammer used inferior parts or techniques, was not up to normal professional standards, and such a failure was reasonably foreseeable, then quite possibly the answer is "Yes". If the hammer was well-made and the failure was an unpredictable accident, then "No".
Was the carpenter liable? If s/he used an improper tool, perhaps using a light tack-hammer where a much heavier one was called for, stressing it so that failure was foreseeable, then perhaps "Yes". If the carpenter acted as a reasonable and skilled person would, then probably "No". In both cases foreseeability, and working to a reasonable standard of care, are key aspects for whether liability is imposed.
Possibly neither the manufacturer nor the carpenter is liable. The accident could be ruled exactly that, an accident with no liability from anyone.
Now let us take the case of the self-driving car. The car's AI makes an error, failing to curve when the road curves, driving into oncoming traffic, causing a crash and injuries. Is the company that made the car (or the subcontractor that wrote the software) liable? It will depend on the detailed facts.
Having a road swerve is a very forseeable situation, so the designers should have included handling it in the design, and should have tested such situations on a number of simulated and actual roads. The quality of both design and testing efforts would be evaluated in detail in assessing whether there is liability here. If the specific cause of the error can be found, that will help. If the cause was a misinterpreted or incorrect road marking, it will be a question if such markings are foreseeable, as they probably are. If a human driver was supposed to be monitoring and taking control in the case of an a=error, that driver might have partial liability.
But the law does not simply throw up its hands and say there is no way to determine cause or liability. It will attempt to apply the same general principles that it does to possible liability for accidents involving a hammer, a train, or any other manufactured product. The details will differ with the jurisdiction, and the specific facts, but whether the accident was reasonably foreseeable, and the degree of care used by the manufacturer will usually be important.