The thought experiment that helped me understand this is to consider a train moving past a station platform. On the platform we have two clocks - one at each end. The clock at the far end of the platform records the time the front of the train passes this point (event A). And, the clock at the near end of the platform records the time the rear of the train passes this point (event B). These clocks are at rest relative to each other and we assume they have been synchronized, so represent a measure of the time coordinate at those points in the platform frame.
Let's assume that, in the platform frame, the moving train is the same length as the platform. This means that the front of the train is at the far end of the platform at the same time as the rear of the train is at the near end of the platform. So, the two clocks record the same time for events A and B. As an aside, that experiment defines a good, operational definition of the length of an object that is moving in the frame of reference in which its length is measured.
Now, if we imagine that the train returns to the platfoms and stops, then we find that the rest length of the train is longer than the platform. Note that we are imagining a relativistic train in this case, so that the length contraction is significant.
So far, so good. We have a simple case of length contraction.
But, now, we consider the events A and B in the frame of the train. We can imagine two more clocks at either end of the train - they are at rest relative to each other and, if synchronized, represent a measure of the time coordinate at those points in the train frame. The platform is not only shorter than the train, but is also length contracted in the train frame (as the platform moves past the train). In any case, event A happens first in the train frame (the front of the train passes the far end of the platform). At this time (in the train frame), the near end of the platform is somewhere along the train. Then, event B happens. At this time (in the train frame), the front of the train has already moved well past the far end of the platform.
We see that events A and B are not simultaneous in the train frame. So, simultaneity (i.e. two events having the same time coordinate in a given frame of reference) depends on the frame of reference.
PS in this case, we derived the relativity of simultaneity from length contraction. It's also possible to derive the relativity of simultaneity directly from the two postulates of SR.