My Number (マイナンバー, the individual number) is a twelve-digit number assigned to everyone with a resident record, foreign residents included. Your employer needs it for tax and social insurance, and a bank or brokerage will ask for it.
The number is not optional. The My Number Card, a photo card with a chip, is: it works as ID, as a health insurance card and for online filing, and you apply for it separately.