Yes, it is possible to set gid to something else in the query and to select "name, location" for the insert, and. But, you need to check the syntax.
Are you interested in learning SQL from the basics! Refer to this video on SQL provided by Intellipaat:
INSERT INTO courses (name, location, gid)
SELECT name, location, 1
WHERE cid = 2
You can add the constant of the same type as gid in its place, not just 1. You can make the cid value.