It means "it (i.e. the thing I am about to describe) happened in this way (i.e. in the way I am about to explain)". The expression does not carry a huge amount of meaning but can be used to introduce the telling of a story. It also tends to suggest that the events were of interest, and worthy of retelling.