I'm currently running Ubuntu in a VMworkstation Pro, when I try to SSH into it, the connection is rejected. But, I can ping Ubuntu IP successfully.
You first need to install openssh-server package using the following command:
sudo apt install openssh-server -y
Make sure to activate the service and check if it really is:
sudo systemctl start ssh sudo systemctl status ssh
To be sure that it is enabled at boot, execute the following command:
sudo systemctl enable ssh