The Mazda5 is assembled in Ujina 2 in Hiroshima, Japan.
Given that the Mazda5 is based on the same platform as the Mazda3 (slightly longer wheelbase), it would initially appear reasonable to think these two vehicles would be assembled at the same location. But they're not, as the Mazda3 is assembled 1.5-2 hours away at Hofu 1 in Hofu, Japan. Mazda3 is so popular and takes up so much capacity that Hofu 1 is completely dedicated to this one vehicle.
Ujina 2, on the other hand, was newly re-opened in 2004 for the purpose of building various models, including the Mazda5. Ujina 2 has a lot of capacity, even after incorporating Mazda5 production. However, a twist fell upon Ujina 2 with the December fire at the Ujina 1 paintshop. So, until this April, the various Ujina 1 models are painted at the Ujina 2 paintshop and then routed back to Ujina 1 to complete assembly. It's actually quite amazing how Mazda did this and demonstrates how flexible their systems are.