Here what you are trying to achieve a typical service oriented architecture. Coming to your questions, creating a web api is a isolated project. For the time being consider it as a seperate application whose whole sole purpose would be to expose some web api methods which can be consumed by client applications. Your web api methods will take care or handling the request and provide response either in form of xm/json/text or may be strong type.
Now assuming in your SharePoint farm solution you are creating a webpart which will display data by calling the above webservice, reading/interpreting the response and creating html controls/labels to display the data.
It would be better to keep your WEB API (web service) project separate, coming to your question on where to deploy the web service totally depends on where you want host it, if you have created a asp.net webservice or WCF service it can be hosted in IIS on any of front end application(ideally you should deploy it to application server).
Hope this helps...