Welcome to the community!
The values of both those expression are not equal after a certain decimal point. Please run the following to understand:
a = torch.rand(1000)
b = torch.rand(1000)

x1 = torch.dot(a,b)
x2 = torch.sum(a*b)

torch.set_printoptions(precision=10)

print(x1.item())
print(x2.item())