why does Starfleet have to conform to exact way of the US navy?
Because it's so much cooler that way.
And beside, the ways of the US Navy are hardly unique for a uniformed military service. Many services around the world (and perhaps on other worlds?) have customs and courtesies that are, if not identical, then similar.