I am doing a small project, where there is a 3d engine, however I do not know how to draw something if it is like the image below. Usually I would draw from farthest back to closest. But here there is no order? How would modern 3d Engines draw this?
The keyword you are looking for is z-buffering.
When a polygon-based rendering engine calculates the pixels covered by a triangle, it doesn't just calculate its x- and y-coordinates on the screen for each pixel, but also it's z-coordinate. The z-coordinate is its distance from the screen.
The engine also creates a z-buffer for each frame it renders. The z-buffer remembers if the engine already drew something to each x/y coordinate, and if it did, what z-coordinate that pixel had. Before the engine calculates the color of a new pixel, it checks if there is already a value in the z-buffer for these coordinates with a lower value than that of the current pixel. When there is, the pixel gets skipped. When there is not, both z-buffer and the image on the screen get overwritten by the current pixel.