try pressing f10 or f12, choose ubuntu from the uefi list
if that doesn't work get an ubuntu live usb, boot it in uefi mode
type sudo apt-get install efibootmgr
then type sudo efibootmgr -v
you should get a list of boot entries with numbers
disable the windows entry with sudo efibootmgr -a -b <number here>
(sudo efibootmgr -A -b <number here> re-enables it)
if it still boots into windows
try pressing f10 or f12, choose ubuntu from the uefi list
if it works skip to part B otherwise
get an ubuntu live usb, boot it in uefi mode
then type sudo parted -l , get the list of partitions
mount the main linux partition with sudo mount /dev/sdxY /mnt
run the following command
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B /mnt$i; done
then sudo chroot /mnt
then type mount -a
part B)
then backup the windows efi files
sudo cp /boot/efi/EFI/Boot/bootx64.efi /boot/efi/EFI/Boot/bootx64.efi.backup
sudo cp /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi.backup
copy the ubuntu efi files over the windows ones
use shimx64.efi incase you're using pre-16.04 ubuntu with secureboot enabled
( mokutil --sb-state should say if it's enabled )
sudo cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/Boot/bootx64.efi
sudo cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
then modify grub to look for the new windows efi file
type nano /usr/lib/os-probes/mounted/efi/20microsoft
edit the line that says bootmgfw.efi to bootmgfw.efi.backup
bootmgfw=$(item_in_dir bootmgfw.efi "$efi/$microsoft/$boot")
to
bootmgfw=$(item_in_dir bootmgfw.efi.backup "$efi/$microsoft/$boot")
then type update-grub