Ren, as Frank says, the A300 was named such as the original concept was for an aircraft that could carry 300 passengers (although it was shortend before it came into production). The A310 was a derivative of the 300 (did it have 10 less frames or something?)
The A320 was a completely different design, and as the 330/340 had already been conceived (jointly) by the time Airbus decided to offer an extended 320, this became the 321. When, shortly after a shortened version was offered, this logically became the 319.
The 340 did in fact take to service before the 330, but this was because the 340 had received more orders, so Airbus prioritised it during flight testing. Essentially, they’re structuturally identical except for the engines and their paraphenalia.
Finally, when yet another shortedned 320 series was planned, it was logical to make it the 318.
The 380 is the only one that dosen’t follow any real logical reason…