for sailing yachts that makes sense. They would use wind for most movement. While in harbor though they want the finer control that being under power allows - they don't need high speed/high power then though. They also don't spend a lot of time in this situation.
Electric tugs are now a thing to do similar for big ships.
A step before that is to have shore power to run things when in port.
In general stopping pollution near populated areas and busy ports is a bigger win and so a good place to start.