When creating or editing a project if you don't specify a project ID, one will be created automatically based on the first letters of the project name.
For example: a project with the name "Amazon Store" will be AS. If I add another project named "Apple Store", the project ID will be AS-1.
Otherwise, you can change it whenever you want by going to project settings (the gear icon on top of the project) → Advanced Project Settings .
When creating a task, you'll notice that a task ID will be created automatically based off the project ID. Hence the only way to change a task ID is to change the project ID.
NOTE: When moving the task to a different project, the task ID will be changed based on the new project ID. Task IDs are incremental and unique for that project.