Think of it like the difference between the police and life guards at a beach.
The police could do life guard jobs, but its a waste of trained personnel and its not really their job.
Lifeguards could stop crimes at the beach but they’re not the best trained or equipped for it.
The Navy is geared for combat operations against enemy naval assets. They can, and sometimes do things that the Coast Guard can do (drug interdiction, search and rescue), its just not what they are geared for and they have other priorities.
The Coast Guard on the other hand do have some assets that can cross over into some light combat operations, but their focus is more domestic, like policing the coast, routine maintenance of waterways, providing assistance etc..
Trying to do everything can spread your resources thin and make it difficult to shift to other tasks, so having two separate but seemingly similar groups can make a huge difference in effectiveness.
Latest Answers