Several theories purport to explain this practice:
The most common is that ships were thought of as floating castles, and the word referred to the defensive "circles" or maru that protected the castle.
The suffix -maru is often applied to words representing something beloved, and sailors applied this suffix to their ships.
The term maru is used in divination and represents perfection or completeness, or the ship as "a small world of its own".
The myth of Hakudo Maru, a celestial being that came to earth and taught humans how to build ships. It is said that the name maru is attached to a ship to secure celestial protection for itself as it travels.
For the past few centuries, only non-warships bore the -maru ending. Its use was intended as a good hope naming convention that would allow a ship to leave port, travel the world, and return safely to home port: hence the complete circle or "round trip" arriving back at its origin unhurt.
"Hinomaru", or "sun-disc", is a name often applied to the national flag of Japan.
(с) вики