Variables are used to store data in AppInventor and come in two types: local and global. Local variables can only be accessed within the block of code they are defined in, while global variables can be accessed from any part of the program. Proper use of local versus global variables depends on whether the data needs to be shared throughout the entire program or just within a specific block. Defining a variable as global or local impacts how and where it can be accessed within an AppInventor program.