A proposal for a five-storey teaching laboratory building and pocket park has been approved despite opposition.