I am new in WordPress. I have created a custom form in WordPress. When clicking on the submit button I want to submit form data using ajax to HubSpot. Please, anyone, help me how to complete this task.
You can't do it easily. You can send AJAX requests only to the same server your site is on.
To send such request to another server, you'll have to use CORS (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
And I don't believe that HubSpot will allow you to set proper headers...
You won't be able to do it with AJAX alone for the reason described as above, but you could ajax to your own site and use PHP's cURL to achieve what you want.